diff --git a/bin/console b/bin/console index b0826611..4d1cddd7 100755 --- a/bin/console +++ b/bin/console @@ -23,7 +23,7 @@ use PHPCensor\Service\BuildService; use Symfony\Component\Console\Application; use b8\Store\Factory; -define('PHPCI_IS_CONSOLE', true); +define('IS_CONSOLE', true); require_once(dirname(__DIR__) . '/bootstrap.php'); diff --git a/bin/daemonise b/bin/daemonise index 25271525..a5c44011 100755 --- a/bin/daemonise +++ b/bin/daemonise @@ -12,7 +12,7 @@ use PHPCensor\Command\DaemoniseCommand; use Symfony\Component\Console\Application; -define('PHPCI_IS_CONSOLE', true); +define('IS_CONSOLE', true); require_once(dirname(__DIR__) . '/bootstrap.php'); diff --git a/bootstrap.php b/bootstrap.php index 6d9f5912..09aaa45e 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -13,28 +13,24 @@ if (!defined('ROOT_DIR')) { define('ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR); } -if (!defined('PHPCI_DIR')) { - define('PHPCI_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR); +if (!defined('SRC_DIR')) { + define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR); } -if (!defined('PHPCI_PUBLIC_DIR')) { - define('PHPCI_PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR); +if (!defined('PUBLIC_DIR')) { + define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR); } -if (!defined('PHPCI_APP_DIR')) { - define('PHPCI_APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR); +if (!defined('APP_DIR')) { + define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR); } -if (!defined('PHPCI_BIN_DIR')) { - define('PHPCI_BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR); +if (!defined('BIN_DIR')) { + define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR); } -if (!defined('PHPCI_RUNTIME_DIR')) { - define('PHPCI_RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR); -} - -if (!defined('PHPCI_BUILDS_DIR')) { - define('PHPCI_BUILDS_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR . 'builds' . DIRECTORY_SEPARATOR); +if (!defined('RUNTIME_DIR')) { + define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR); } if (!defined('IS_WIN')) { @@ -45,29 +41,29 @@ require_once(ROOT_DIR . 'vendor/autoload.php'); \PHPCensor\ErrorHandler::register(); -if (defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) { - $loggerConfig = LoggerConfig::newFromFile(PHPCI_APP_DIR . "loggerconfig.php"); +if (defined('IS_CONSOLE') && IS_CONSOLE) { + $loggerConfig = LoggerConfig::newFromFile(APP_DIR . "loggerconfig.php"); } // Load configuration if present: $conf = []; $conf['b8']['app']['namespace'] = 'PHPCensor'; $conf['b8']['app']['default_controller'] = 'Home'; -$conf['b8']['view']['path'] = PHPCI_DIR . 'View' . DIRECTORY_SEPARATOR; +$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR; $config = new b8\Config($conf); -$configFile = PHPCI_APP_DIR . 'config.yml'; +$configFile = APP_DIR . 'config.yml'; if (file_exists($configFile)) { $config->loadYaml($configFile); } -if (!defined('PHPCI_URL') && !empty($config)) { - define('PHPCI_URL', $config->get('phpci.url', '') . '/'); +if (!defined('APP_URL') && !empty($config)) { + define('APP_URL', $config->get('phpci.url', '') . '/'); } -if (!defined('PHPCI_IS_CONSOLE')) { - define('PHPCI_IS_CONSOLE', false); +if (!defined('IS_CONSOLE')) { + define('IS_CONSOLE', false); } \PHPCensor\Helper\Lang::init($config); diff --git a/docs/en/sources/git.md b/docs/en/sources/git.md index 3bbf58cc..42f3bfe3 100644 --- a/docs/en/sources/git.md +++ b/docs/en/sources/git.md @@ -16,7 +16,7 @@ Installation #!/bin/sh PROJECT_ID=1 -PHPCI_URL="http://my.server.com/PHPCI/" +APP_URL="http://my.server.com/PHPCI/" trigger_hook() { NEWREV="$2" @@ -44,7 +44,7 @@ trigger_hook() { --data-urlencode commit="$NEWREV" \ --data-urlencode committer="$COMMITTER" \ --data-urlencode message="$MESSAGE" \ - "$PHPCI_URL/webhook/git/$PROJECT_ID" + "$APP_URL/webhook/git/$PROJECT_ID" } if [ -n "$1" -a -n "$2" -a -n "$3" ]; then diff --git a/public/assets/js/build.js b/public/assets/js/build.js index 66dd8bb8..c1c24120 100644 --- a/public/assets/js/build.js +++ b/public/assets/js/build.js @@ -76,10 +76,10 @@ var Build = Class.extend({ var query = query || {}; var cb = function() { - var fullUri = window.PHPCI_URL + uri; + var fullUri = window.APP_URL + uri; if (name == 'build-updated') { - fullUri = window.PHPCI_URL + 'build/data/' + self.buildId; + fullUri = window.APP_URL + 'build/data/' + self.buildId; } $.ajax({ diff --git a/public/assets/js/phpci.js b/public/assets/js/phpci.js index f7d8f59d..b767fe5f 100644 --- a/public/assets/js/phpci.js +++ b/public/assets/js/phpci.js @@ -4,7 +4,7 @@ var PHPCensor = { init: function () { // Setup the date locale - moment.locale(PHPCI_LANGUAGE); + moment.locale(LANGUAGE); $(document).ready(function () { // Format datetimes @@ -19,7 +19,7 @@ var PHPCensor = { PHPCensor.intervals.getBuilds = setInterval(PHPCensor.getBuilds, 5000); // Update latest project builds every 10 seconds: - if (typeof PHPCI_PROJECT_ID != 'undefined') { + if (typeof PROJECT_ID != 'undefined') { PHPCensor.intervals.getProjectBuilds = setInterval(PHPCensor.getProjectBuilds, 10000); } @@ -33,7 +33,7 @@ var PHPCensor = { getBuilds: function () { $.ajax({ - url: PHPCI_URL + 'build/latest', + url: APP_URL + 'build/latest', success: function (data) { $(window).trigger('builds-updated', [data]); @@ -45,7 +45,7 @@ var PHPCensor = { getProjectBuilds: function () { $.ajax({ - url: PHPCI_URL + 'project/builds/' + PHPCI_PROJECT_ID + '?branch=' + PHPCI_PROJECT_BRANCH, + url: APP_URL + 'project/builds/' + PROJECT_ID + '?branch=' + PROJECT_BRANCH, success: function (data) { $('#latest-builds').html(data); @@ -86,7 +86,7 @@ var PHPCensor = { get: function (uri, success) { $.ajax({ - url: window.PHPCI_URL + uri, + url: window.APP_URL + uri, success: function (data) { success(); @@ -99,7 +99,7 @@ var PHPCensor = { handleFailedAjax: function (xhr) { if (xhr.status == 401) { - window.location.href = window.PHPCI_URL + 'session/login'; + window.location.href = window.APP_URL + 'session/login'; } }, @@ -409,7 +409,7 @@ function setupProjectForm() $.ajax({ dataType: "json", - url: window.PHPCI_URL + 'project/github-repositories', + url: window.APP_URL + 'project/github-repositories', success: function (data) { $('#loading').hide(); @@ -463,8 +463,8 @@ var Lang = { var args = Array.prototype.slice.call(arguments);; var string = args.shift(); - if (PHPCI_STRINGS[string]) { - args.unshift(PHPCI_STRINGS[string]); + if (STRINGS[string]) { + args.unshift(STRINGS[string]); return sprintf.apply(sprintf[0], args); } @@ -472,4 +472,4 @@ var Lang = { } }; -moment.locale(PHPCI_LANGUAGE); \ No newline at end of file +moment.locale(LANGUAGE); \ No newline at end of file diff --git a/src/PHPCensor/Application.php b/src/PHPCensor/Application.php index 363bd021..632ded94 100644 --- a/src/PHPCensor/Application.php +++ b/src/PHPCensor/Application.php @@ -64,7 +64,7 @@ class Application extends b8\Application } else { $_SESSION['phpci_login_redirect'] = substr($request->getPath(), 1); $response = new RedirectResponse($response); - $response->setHeader('Location', PHPCI_URL . 'session/login'); + $response->setHeader('Location', APP_URL . 'session/login'); } return false; diff --git a/src/PHPCensor/Builder.php b/src/PHPCensor/Builder.php index cba0fff3..61480aed 100644 --- a/src/PHPCensor/Builder.php +++ b/src/PHPCensor/Builder.php @@ -110,7 +110,7 @@ class Builder implements LoggerAwareInterface $this->buildLogger = new BuildLogger($logger, $build); $pluginFactory = $this->buildPluginFactory($build); - $pluginFactory->addConfigFromFile(PHPCI_APP_DIR . "pluginconfig.php"); + $pluginFactory->addConfigFromFile(APP_DIR . "pluginconfig.php"); $this->pluginExecutor = new Plugin\Util\Executor($pluginFactory, $this->buildLogger); $executorClass = 'PHPCensor\Helper\UnixCommandExecutor'; @@ -314,7 +314,7 @@ class Builder implements LoggerAwareInterface $this->interpolator->setupInterpolationVars( $this->build, $this->buildPath, - PHPCI_URL + APP_URL ); $this->commandExecutor->setBuildPath($this->buildPath); diff --git a/src/PHPCensor/Command/DaemonCommand.php b/src/PHPCensor/Command/DaemonCommand.php index f2a3c59e..449c27d6 100644 --- a/src/PHPCensor/Command/DaemonCommand.php +++ b/src/PHPCensor/Command/DaemonCommand.php @@ -114,7 +114,7 @@ class DaemonCommand extends Command $this->logger->info("Trying to start the daemon"); $cmd = "nohup %sdaemonise phpci:daemonise > %s 2>&1 &"; - $command = sprintf($cmd, PHPCI_BIN_DIR, $this->logFilePath); + $command = sprintf($cmd, BIN_DIR, $this->logFilePath); $output = $exitCode = null; exec($command, $output, $exitCode); diff --git a/src/PHPCensor/Command/DaemoniseCommand.php b/src/PHPCensor/Command/DaemoniseCommand.php index b4e3b0f6..8f5d03ab 100644 --- a/src/PHPCensor/Command/DaemoniseCommand.php +++ b/src/PHPCensor/Command/DaemoniseCommand.php @@ -66,7 +66,7 @@ class DaemoniseCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { $cmd = "echo %s > '%sdaemon/daemon.pid'"; - $command = sprintf($cmd, getmypid(), PHPCI_RUNTIME_DIR); + $command = sprintf($cmd, getmypid(), RUNTIME_DIR); exec($command); $this->output = $output; diff --git a/src/PHPCensor/Command/InstallCommand.php b/src/PHPCensor/Command/InstallCommand.php index cb6c7e54..f849795b 100644 --- a/src/PHPCensor/Command/InstallCommand.php +++ b/src/PHPCensor/Command/InstallCommand.php @@ -37,7 +37,7 @@ class InstallCommand extends Command protected function configure() { - $defaultPath = PHPCI_APP_DIR . 'config.yml'; + $defaultPath = APP_DIR . 'config.yml'; $this ->setName('phpci:install') @@ -383,7 +383,7 @@ class InstallCommand extends Command $output->write(Lang::get('setting_up_db')); $phinxBinary = escapeshellarg(ROOT_DIR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'phinx'); - $phinxScript = escapeshellarg(PHPCI_APP_DIR . 'phinx.php'); + $phinxScript = escapeshellarg(APP_DIR . 'phinx.php'); shell_exec($phinxBinary . ' migrate -c ' . $phinxScript); $output->writeln(''.Lang::get('ok').''); diff --git a/src/PHPCensor/Command/PollCommand.php b/src/PHPCensor/Command/PollCommand.php index 9a7ffa7a..d7fa8048 100644 --- a/src/PHPCensor/Command/PollCommand.php +++ b/src/PHPCensor/Command/PollCommand.php @@ -51,7 +51,7 @@ class PollCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { $parser = new Parser(); - $yaml = file_get_contents(PHPCI_APP_DIR . 'config.yml'); + $yaml = file_get_contents(APP_DIR . 'config.yml'); $this->settings = $parser->parse($yaml); $token = $this->settings['phpci']['github']['token']; diff --git a/src/PHPCensor/Command/RunCommand.php b/src/PHPCensor/Command/RunCommand.php index 6c0a1883..5e507745 100644 --- a/src/PHPCensor/Command/RunCommand.php +++ b/src/PHPCensor/Command/RunCommand.php @@ -87,7 +87,7 @@ class RunCommand extends Command // Allow PHPCI to run in "debug mode" if ($input->hasOption('debug') && $input->getOption('debug')) { $output->writeln('Debug mode enabled.'); - define('PHPCI_DEBUG_MODE', true); + define('DEBUG_MODE', true); } $running = $this->validateRunningBuilds(); diff --git a/src/PHPCensor/Command/UpdateCommand.php b/src/PHPCensor/Command/UpdateCommand.php index 295ab5df..20013b7f 100644 --- a/src/PHPCensor/Command/UpdateCommand.php +++ b/src/PHPCensor/Command/UpdateCommand.php @@ -53,7 +53,7 @@ class UpdateCommand extends Command $output->write(Lang::get('updating_phpci')); - shell_exec(ROOT_DIR . 'vendor/bin/phinx migrate -c "' . PHPCI_APP_DIR . 'phinx.php"'); + shell_exec(ROOT_DIR . 'vendor/bin/phinx migrate -c "' . APP_DIR . 'phinx.php"'); $output->writeln(''.Lang::get('ok').''); } diff --git a/src/PHPCensor/Command/WorkerCommand.php b/src/PHPCensor/Command/WorkerCommand.php index 6cf0cc20..eea084dd 100644 --- a/src/PHPCensor/Command/WorkerCommand.php +++ b/src/PHPCensor/Command/WorkerCommand.php @@ -69,7 +69,7 @@ class WorkerCommand extends Command // Allow PHPCI to run in "debug mode" if ($input->hasOption('debug') && $input->getOption('debug')) { $output->writeln('Debug mode enabled.'); - define('PHPCI_DEBUG_MODE', true); + define('DEBUG_MODE', true); } $config = Config::getInstance()->get('phpci.worker', []); diff --git a/src/PHPCensor/Controller/BuildController.php b/src/PHPCensor/Controller/BuildController.php index a44cd410..743426ec 100644 --- a/src/PHPCensor/Controller/BuildController.php +++ b/src/PHPCensor/Controller/BuildController.php @@ -88,10 +88,10 @@ class BuildController extends Controller } $rebuild = Lang::get('rebuild_now'); - $rebuildLink = PHPCI_URL . 'build/rebuild/' . $build->getId(); + $rebuildLink = APP_URL . 'build/rebuild/' . $build->getId(); $delete = Lang::get('delete_build'); - $deleteLink = PHPCI_URL . 'build/delete/' . $build->getId(); + $deleteLink = APP_URL . 'build/delete/' . $build->getId(); $actions = "{$rebuild} "; @@ -109,7 +109,7 @@ class BuildController extends Controller protected function getUiPlugins() { $rtn = []; - $path = PHPCI_PUBLIC_DIR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'build-plugins' . DIRECTORY_SEPARATOR; + $path = PUBLIC_DIR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'build-plugins' . DIRECTORY_SEPARATOR; $dir = opendir($path); while ($item = readdir($dir)) { @@ -206,7 +206,7 @@ class BuildController extends Controller } $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); + $response->setHeader('Location', APP_URL.'build/view/' . $build->getId()); return $response; } @@ -226,7 +226,7 @@ class BuildController extends Controller $this->buildService->deleteBuild($build); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/' . $build->getProjectId()); + $response->setHeader('Location', APP_URL.'project/view/' . $build->getProjectId()); return $response; } diff --git a/src/PHPCensor/Controller/GroupController.php b/src/PHPCensor/Controller/GroupController.php index f8771c43..808dc17b 100644 --- a/src/PHPCensor/Controller/GroupController.php +++ b/src/PHPCensor/Controller/GroupController.php @@ -80,13 +80,13 @@ class GroupController extends Controller $this->groupStore->save($group); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'group'); + $response->setHeader('Location', APP_URL.'group'); return $response; } $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : '')); + $form->setAction(APP_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : '')); $title = new Form\Element\Text('title'); $title->setContainerClass('form-group'); @@ -115,7 +115,7 @@ class GroupController extends Controller $this->groupStore->delete($group); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'group'); + $response->setHeader('Location', APP_URL.'group'); return $response; } } diff --git a/src/PHPCensor/Controller/PluginController.php b/src/PHPCensor/Controller/PluginController.php index e0f0c82a..71868c7d 100644 --- a/src/PHPCensor/Controller/PluginController.php +++ b/src/PHPCensor/Controller/PluginController.php @@ -36,7 +36,7 @@ class PluginController extends Controller $this->view->installedPackages = $json['require']; $pluginInfo = new PluginInformationCollection(); - $pluginInfo->add(FilesPluginInformation::newFromDir(PHPCI_DIR . "Plugin" . DIRECTORY_SEPARATOR)); + $pluginInfo->add(FilesPluginInformation::newFromDir(SRC_DIR . "Plugin" . DIRECTORY_SEPARATOR)); $pluginInfo->add(ComposerPluginInformation::buildFromYaml( ROOT_DIR . "vendor" . DIRECTORY_SEPARATOR . "composer" . DIRECTORY_SEPARATOR . "installed.json" )); diff --git a/src/PHPCensor/Controller/ProjectController.php b/src/PHPCensor/Controller/ProjectController.php index 56e19891..d187c516 100644 --- a/src/PHPCensor/Controller/ProjectController.php +++ b/src/PHPCensor/Controller/ProjectController.php @@ -79,7 +79,7 @@ class ProjectController extends PHPCensor\Controller if ($page > $pages) { $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/'.$projectId); + $response->setHeader('Location', APP_URL.'project/view/'.$projectId); return $response; } @@ -121,7 +121,7 @@ class ProjectController extends PHPCensor\Controller } $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId()); + $response->setHeader('Location', APP_URL.'build/view/' . $build->getId()); return $response; } @@ -136,7 +136,7 @@ class ProjectController extends PHPCensor\Controller $this->projectService->deleteProject($project); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL); + $response->setHeader('Location', APP_URL); return $response; } @@ -230,7 +230,7 @@ class ProjectController extends PHPCensor\Controller $project = $this->projectService->createProject($title, $type, $reference, $options); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId()); + $response->setHeader('Location', APP_URL.'project/view/' . $project->getId()); return $response; } } @@ -295,7 +295,7 @@ class ProjectController extends PHPCensor\Controller $project = $this->projectService->updateProject($project, $title, $type, $reference, $options); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId()); + $response->setHeader('Location', APP_URL.'project/view/' . $project->getId()); return $response; } @@ -306,7 +306,7 @@ class ProjectController extends PHPCensor\Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL.'project/' . $type); + $form->setAction(APP_URL.'project/' . $type); $form->addField(new Form\Element\Csrf('csrf')); $form->addField(new Form\Element\Hidden('pubkey')); diff --git a/src/PHPCensor/Controller/SessionController.php b/src/PHPCensor/Controller/SessionController.php index e7f3f46f..863d0f83 100644 --- a/src/PHPCensor/Controller/SessionController.php +++ b/src/PHPCensor/Controller/SessionController.php @@ -66,7 +66,7 @@ class SessionController extends Controller $form = new b8\Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL.'session/login'); + $form->setAction(APP_URL.'session/login'); $email = new b8\Form\Element\Email('email'); $email->setLabel(Lang::get('email_address')); @@ -110,7 +110,7 @@ class SessionController extends Controller session_destroy(); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL); + $response->setHeader('Location', APP_URL); return $response; } @@ -130,7 +130,7 @@ class SessionController extends Controller } $key = md5(date('Y-m-d') . $user->getHash()); - $url = PHPCI_URL; + $url = APP_URL; $message = Lang::get('reset_email_body', $user->getName(), $url, $user->getId(), $key); @@ -170,7 +170,7 @@ class SessionController extends Controller $_SESSION['phpci_user_id'] = $user->getId(); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL); + $response->setHeader('Location', APP_URL); return $response; } @@ -186,7 +186,7 @@ class SessionController extends Controller */ protected function getLoginRedirect() { - $rtn = PHPCI_URL; + $rtn = APP_URL; if (!empty($_SESSION['phpci_login_redirect'])) { $rtn .= $_SESSION['phpci_login_redirect']; diff --git a/src/PHPCensor/Controller/SettingsController.php b/src/PHPCensor/Controller/SettingsController.php index a45413c5..8316bd79 100644 --- a/src/PHPCensor/Controller/SettingsController.php +++ b/src/PHPCensor/Controller/SettingsController.php @@ -40,7 +40,7 @@ class SettingsController extends Controller parent::init(); $parser = new Parser(); - $yaml = file_get_contents(PHPCI_APP_DIR . 'config.yml'); + $yaml = file_get_contents(APP_DIR . 'config.yml'); $this->settings = $parser->parse($yaml); } @@ -76,7 +76,7 @@ class SettingsController extends Controller $authSettings = $this->settings['phpci']['authentication_settings']; } - $this->view->configFile = PHPCI_APP_DIR . 'config.yml'; + $this->view->configFile = APP_DIR . 'config.yml'; $this->view->basicSettings = $this->getBasicForm($basicSettings); $this->view->buildSettings = $this->getBuildForm($buildSettings); $this->view->github = $this->getGithubForm(); @@ -105,9 +105,9 @@ class SettingsController extends Controller $response = new b8\Http\Response\RedirectResponse(); if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + $response->setHeader('Location', APP_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + $response->setHeader('Location', APP_URL . 'settings?saved=1'); } return $response; @@ -128,9 +128,9 @@ class SettingsController extends Controller $response = new b8\Http\Response\RedirectResponse(); if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + $response->setHeader('Location', APP_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + $response->setHeader('Location', APP_URL . 'settings?saved=1'); } return $response; @@ -150,9 +150,9 @@ class SettingsController extends Controller $response = new b8\Http\Response\RedirectResponse(); if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + $response->setHeader('Location', APP_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + $response->setHeader('Location', APP_URL . 'settings?saved=1'); } return $response; @@ -171,9 +171,9 @@ class SettingsController extends Controller $response = new b8\Http\Response\RedirectResponse(); if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + $response->setHeader('Location', APP_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + $response->setHeader('Location', APP_URL . 'settings?saved=1'); } return $response; @@ -194,9 +194,9 @@ class SettingsController extends Controller $response = new b8\Http\Response\RedirectResponse(); if ($error) { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=2'); + $response->setHeader('Location', APP_URL . 'settings?saved=2'); } else { - $response->setHeader('Location', PHPCI_URL . 'settings?saved=1'); + $response->setHeader('Location', APP_URL . 'settings?saved=1'); } return $response; @@ -223,13 +223,13 @@ class SettingsController extends Controller $this->storeSettings(); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'settings?linked=1'); + $response->setHeader('Location', APP_URL . 'settings?linked=1'); return $response; } } $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'settings?linked=2'); + $response->setHeader('Location', APP_URL . 'settings?linked=2'); return $response; } @@ -242,7 +242,7 @@ class SettingsController extends Controller { $dumper = new Dumper(); $yaml = $dumper->dump($this->settings, 4); - file_put_contents(PHPCI_APP_DIR . 'config.yml', $yaml); + file_put_contents(APP_DIR . 'config.yml', $yaml); if (error_get_last()) { $error_get_last = error_get_last(); @@ -258,7 +258,7 @@ class SettingsController extends Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/github'); + $form->setAction(APP_URL . 'settings/github'); $form->addField(new Form\Element\Csrf('csrf')); $field = new Form\Element\Text('githubid'); @@ -302,7 +302,7 @@ class SettingsController extends Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/email'); + $form->setAction(APP_URL . 'settings/email'); $form->addField(new Form\Element\Csrf('csrf')); $field = new Form\Element\Text('smtp_address'); @@ -387,7 +387,7 @@ class SettingsController extends Controller */ protected function canWriteConfig() { - return is_writeable(PHPCI_APP_DIR . 'config.yml'); + return is_writeable(APP_DIR . 'config.yml'); } /** @@ -399,7 +399,7 @@ class SettingsController extends Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/build'); + $form->setAction(APP_URL . 'settings/build'); $field = new Form\Element\Select('failed_after'); $field->setRequired(false); @@ -436,7 +436,7 @@ class SettingsController extends Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/basic'); + $form->setAction(APP_URL . 'settings/basic'); $field = new Form\Element\Select('language'); $field->setRequired(true); @@ -468,7 +468,7 @@ class SettingsController extends Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL . 'settings/authentication'); + $form->setAction(APP_URL . 'settings/authentication'); $form->addField(new Form\Element\Csrf('csrf')); $field = new Form\Element\Checkbox('disable_authentication'); diff --git a/src/PHPCensor/Controller/UserController.php b/src/PHPCensor/Controller/UserController.php index 1ba3a799..ea14dfc8 100644 --- a/src/PHPCensor/Controller/UserController.php +++ b/src/PHPCensor/Controller/UserController.php @@ -92,7 +92,7 @@ class UserController extends Controller } $form = new Form(); - $form->setAction(PHPCI_URL.'user/profile'); + $form->setAction(APP_URL.'user/profile'); $form->setMethod('POST'); $name = new Form\Element\Text('name'); @@ -174,7 +174,7 @@ class UserController extends Controller $this->userService->createUser($name, $email, $password, $isAdmin); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'user'); + $response->setHeader('Location', APP_URL . 'user'); return $response; } @@ -215,7 +215,7 @@ class UserController extends Controller $this->userService->updateUser($user, $name, $email, $password, $isAdmin); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'user'); + $response->setHeader('Location', APP_URL . 'user'); return $response; } @@ -226,7 +226,7 @@ class UserController extends Controller { $form = new Form(); $form->setMethod('POST'); - $form->setAction(PHPCI_URL.'user/' . $type); + $form->setAction(APP_URL.'user/' . $type); $form->addField(new Form\Element\Csrf('csrf')); $field = new Form\Element\Email('email'); @@ -289,7 +289,7 @@ class UserController extends Controller $this->userService->deleteUser($user); $response = new b8\Http\Response\RedirectResponse(); - $response->setHeader('Location', PHPCI_URL . 'user'); + $response->setHeader('Location', APP_URL . 'user'); return $response; } } diff --git a/src/PHPCensor/Helper/Lang.php b/src/PHPCensor/Helper/Lang.php index ef63a2fb..04771261 100644 --- a/src/PHPCensor/Helper/Lang.php +++ b/src/PHPCensor/Helper/Lang.php @@ -104,7 +104,7 @@ class Lang { $languages = []; foreach (self::$languages as $language) { - $strings = include_once(PHPCI_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php'); + $strings = include_once(SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php'); $languages[$language] = !empty($strings['language_name']) ? $strings['language_name'] : $language; } @@ -171,7 +171,7 @@ class Lang protected static function loadLanguage($language = null) { $language = $language ? $language : self::$language; - $langFile = PHPCI_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php'; + $langFile = SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php'; if (!file_exists($langFile)) { return null; @@ -191,7 +191,7 @@ class Lang protected static function loadAvailableLanguages() { $matches = []; - foreach (glob(PHPCI_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.*.php') as $file) { + foreach (glob(SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.*.php') as $file) { if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) { self::$languages[] = $matches[1]; } diff --git a/src/PHPCensor/Logging/BuildLogger.php b/src/PHPCensor/Logging/BuildLogger.php index 16e43780..f7b277a6 100644 --- a/src/PHPCensor/Logging/BuildLogger.php +++ b/src/PHPCensor/Logging/BuildLogger.php @@ -100,7 +100,7 @@ class BuildLogger implements LoggerAwareInterface */ public function logDebug($message) { - if (defined('PHPCI_DEBUG_MODE') && PHPCI_DEBUG_MODE) { + if (defined('DEBUG_MODE') && DEBUG_MODE) { $this->log("\033[0;36m" . $message . "\033[0m"); } } diff --git a/src/PHPCensor/Model/Build.php b/src/PHPCensor/Model/Build.php index 74183b07..939c3623 100644 --- a/src/PHPCensor/Model/Build.php +++ b/src/PHPCensor/Model/Build.php @@ -135,7 +135,7 @@ class Build extends BuildBase */ protected function getZeroConfigPlugins(Builder $builder) { - $pluginDir = PHPCI_DIR . 'Plugin' . DIRECTORY_SEPARATOR; + $pluginDir = SRC_DIR . 'Plugin' . DIRECTORY_SEPARATOR; $dir = new \DirectoryIterator($pluginDir); $config = [ @@ -258,7 +258,7 @@ class Build extends BuildBase if (empty($this->currentBuildPath)) { $buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5); - $this->currentBuildPath = PHPCI_BUILDS_DIR . $buildDirectory . DIRECTORY_SEPARATOR; + $this->currentBuildPath = RUNTIME_DIR . 'builds' . DIRECTORY_SEPARATOR . $buildDirectory . DIRECTORY_SEPARATOR; } return $this->currentBuildPath; diff --git a/src/PHPCensor/Plugin/Campfire.php b/src/PHPCensor/Plugin/Campfire.php index a1073294..2bacf8fb 100644 --- a/src/PHPCensor/Plugin/Campfire.php +++ b/src/PHPCensor/Plugin/Campfire.php @@ -63,7 +63,7 @@ class Campfire implements Plugin */ public function execute() { - $url = PHPCI_URL . "build/view/" . $this->build->getId(); + $url = APP_URL . "build/view/" . $this->build->getId(); $message = str_replace("%buildurl%", $url, $this->message); $this->joinRoom($this->roomId); $status = $this->speak($message, $this->roomId); diff --git a/src/PHPCensor/Plugin/Mysql.php b/src/PHPCensor/Plugin/Mysql.php index 49fe1314..c017b583 100644 --- a/src/PHPCensor/Plugin/Mysql.php +++ b/src/PHPCensor/Plugin/Mysql.php @@ -69,7 +69,7 @@ class Mysql implements Plugin $config = Database::getConnection('write')->getDetails(); - $this->host =(defined('PHPCI_DB_HOST')) ? PHPCI_DB_HOST : null; + $this->host =(defined('DB_HOST')) ? DB_HOST : null; $this->user = $config['user']; $this->pass = $config['pass']; diff --git a/src/PHPCensor/Plugin/Util/Factory.php b/src/PHPCensor/Plugin/Util/Factory.php index 416fd41d..9956b166 100644 --- a/src/PHPCensor/Plugin/Util/Factory.php +++ b/src/PHPCensor/Plugin/Util/Factory.php @@ -10,9 +10,9 @@ use Pimple\Container; */ class Factory { - const TYPE_ARRAY = "array"; - const TYPE_CALLABLE = "callable"; - const INTERFACE_PHPCI_PLUGIN = '\PHPCensor\Plugin'; + const TYPE_ARRAY = "array"; + const TYPE_CALLABLE = "callable"; + const INTERFACE_PLUGIN = '\PHPCensor\Plugin'; private $currentPluginOptions; @@ -79,9 +79,9 @@ class Factory $reflectedPlugin = new \ReflectionClass($className); - if (!$reflectedPlugin->implementsInterface(self::INTERFACE_PHPCI_PLUGIN)) { + if (!$reflectedPlugin->implementsInterface(self::INTERFACE_PLUGIN)) { throw new \InvalidArgumentException( - "Requested class must implement " . self:: INTERFACE_PHPCI_PLUGIN + "Requested class must implement " . self:: INTERFACE_PLUGIN ); } diff --git a/src/PHPCensor/Service/BuildStatusService.php b/src/PHPCensor/Service/BuildStatusService.php index 9cddb976..76aaa962 100644 --- a/src/PHPCensor/Service/BuildStatusService.php +++ b/src/PHPCensor/Service/BuildStatusService.php @@ -57,8 +57,8 @@ class BuildStatusService if ($this->build) { $this->loadParentBuild($isParent); } - if (defined('PHPCI_URL')) { - $this->setUrl(PHPCI_URL); + if (defined('APP_URL')) { + $this->setUrl(APP_URL); } } diff --git a/src/PHPCensor/View/Build/header-row.phtml b/src/PHPCensor/View/Build/header-row.phtml index f1ee6561..417c1c72 100644 --- a/src/PHPCensor/View/Build/header-row.phtml +++ b/src/PHPCensor/View/Build/header-row.phtml @@ -1,6 +1,6 @@
  • - + getCommitterEmail()): ?>
    diff --git a/src/PHPCensor/View/Build/view.phtml b/src/PHPCensor/View/Build/view.phtml index 86226c0a..05fe8ee1 100644 --- a/src/PHPCensor/View/Build/view.phtml +++ b/src/PHPCensor/View/Build/view.phtml @@ -14,7 +14,7 @@ - + getProject()->getTitle(); ?> @@ -160,7 +160,7 @@
    - + ' . PHP_EOL; + print '' . PHP_EOL; } ?> @@ -181,7 +181,7 @@ foreach ($plugins as $plugin) { $('#delete-build').on('click', function (e) { e.preventDefault(); confirmDelete( - "build/delete/getId(); ?>", "Build" + "build/delete/getId(); ?>", "Build" ).onCloseConfirmed = function () {window.location = '/'}; }); }); diff --git a/src/PHPCensor/View/BuildStatus/view.phtml b/src/PHPCensor/View/BuildStatus/view.phtml index d3d2a600..f602af76 100644 --- a/src/PHPCensor/View/BuildStatus/view.phtml +++ b/src/PHPCensor/View/BuildStatus/view.phtml @@ -7,26 +7,26 @@ - + - - + + - + - - - - - + + + + + diff --git a/src/PHPCensor/View/BuildsTable.phtml b/src/PHPCensor/View/BuildsTable.phtml index 9c78218e..3280b7aa 100644 --- a/src/PHPCensor/View/BuildsTable.phtml +++ b/src/PHPCensor/View/BuildsTable.phtml @@ -38,9 +38,9 @@ switch($build->getStatus()) } ?> - #getId(), 6, '0', STR_PAD_LEFT); ?> + #getId(), 6, '0', STR_PAD_LEFT); ?> getCreated()->format('Y-m-d H:i:s'); ?> - + getStatus())
    - + User()->getIsAdmin()): ?>
    diff --git a/src/PHPCensor/View/Email/layout.phtml b/src/PHPCensor/View/Email/layout.phtml index 60694afa..c845d64c 100644 --- a/src/PHPCensor/View/Email/layout.phtml +++ b/src/PHPCensor/View/Email/layout.phtml @@ -20,7 +20,7 @@ diff --git a/src/PHPCensor/View/Group/index.phtml b/src/PHPCensor/View/Group/index.phtml index d912d79c..f1018f3e 100644 --- a/src/PHPCensor/View/Group/index.phtml +++ b/src/PHPCensor/View/Group/index.phtml @@ -1,6 +1,6 @@
    - +
    @@ -24,12 +24,12 @@ - + - + diff --git a/src/PHPCensor/View/Home/index.phtml b/src/PHPCensor/View/Home/index.phtml index 1cda16e7..debbf7ce 100644 --- a/src/PHPCensor/View/Home/index.phtml +++ b/src/PHPCensor/View/Home/index.phtml @@ -73,11 +73,11 @@

    - + getProject()->getTitle(); ?> - - + Build #getId(); ?> - diff --git a/src/PHPCensor/View/Project/view.phtml b/src/PHPCensor/View/Project/view.phtml index f5a54a0d..58071311 100644 --- a/src/PHPCensor/View/Project/view.phtml +++ b/src/PHPCensor/View/Project/view.phtml @@ -1,20 +1,20 @@
    - + - +
    - + @@ -26,14 +26,14 @@
    @@ -78,17 +78,17 @@ switch($project->getType()) { case 'github': - $url = PHPCI_URL . 'webhook/github/' . $project->getId(); + $url = APP_URL . 'webhook/github/' . $project->getId(); Lang::out('webhooks_help_github', $project->getReference()); break; case 'gitlab': - $url = PHPCI_URL. 'webhook/gitlab/' . $project->getId(); + $url = APP_URL. 'webhook/gitlab/' . $project->getId(); Lang::out('webhooks_help_gitlab'); break; case 'bitbucket': - $url = PHPCI_URL . 'webhook/bitbucket/' . $project->getId(); + $url = APP_URL . 'webhook/bitbucket/' . $project->getId(); Lang::out('webhooks_help_bitbucket', $project->getReference()); break; } @@ -111,7 +111,7 @@ print '
      '; -$project_url = PHPCI_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : ''); +$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : ''); if ($page > 1) { print '
    • '.Lang::get('prev_link').'
    • '; diff --git a/src/PHPCensor/View/Session.phtml b/src/PHPCensor/View/Session.phtml index fc68b948..c8d8c039 100644 --- a/src/PHPCensor/View/Session.phtml +++ b/src/PHPCensor/View/Session.phtml @@ -48,7 +48,7 @@
      diff --git a/src/PHPCensor/View/Session/forgotPassword.phtml b/src/PHPCensor/View/Session/forgotPassword.phtml index 069c1b6a..1ebdadf0 100644 --- a/src/PHPCensor/View/Session/forgotPassword.phtml +++ b/src/PHPCensor/View/Session/forgotPassword.phtml @@ -15,7 +15,7 @@
      -
      +
      diff --git a/src/PHPCensor/View/Session/login.phtml b/src/PHPCensor/View/Session/login.phtml index ecb7a386..e53ab58a 100644 --- a/src/PHPCensor/View/Session/login.phtml +++ b/src/PHPCensor/View/Session/login.phtml @@ -4,6 +4,6 @@ - + \ No newline at end of file diff --git a/src/PHPCensor/View/Session/resetPassword.phtml b/src/PHPCensor/View/Session/resetPassword.phtml index f4b39f88..dab61ef0 100644 --- a/src/PHPCensor/View/Session/resetPassword.phtml +++ b/src/PHPCensor/View/Session/resetPassword.phtml @@ -6,7 +6,7 @@
      - +
      diff --git a/src/PHPCensor/View/Settings/index.phtml b/src/PHPCensor/View/Settings/index.phtml index b7d6fd61..e7a3dfc7 100644 --- a/src/PHPCensor/View/Settings/index.phtml +++ b/src/PHPCensor/View/Settings/index.phtml @@ -56,7 +56,7 @@ $id = $settings['phpci']['github']['id']; } - $returnTo = PHPCI_URL . 'settings/github-callback'; + $returnTo = APP_URL . 'settings/github-callback'; $githubUri = 'https://github.com/login/oauth/authorize?client_id='.$id.'&scope=repo&redirect_uri=' . $returnTo; ?> diff --git a/src/PHPCensor/View/SummaryTable.phtml b/src/PHPCensor/View/SummaryTable.phtml index a43706df..c1fb9c41 100644 --- a/src/PHPCensor/View/SummaryTable.phtml +++ b/src/PHPCensor/View/SummaryTable.phtml @@ -85,7 +85,7 @@ foreach($projects as $project):

      - + getTitle(); ?>

      @@ -98,7 +98,7 @@ foreach($projects as $project):
      - + (getId()]; ?>) @@ -107,7 +107,7 @@ foreach($projects as $project): echo ''; } else { $build = $builds[$project->getId()][$idx]; - $link = PHPCI_URL . 'build/view/' . $build->id; + $link = APP_URL . 'build/view/' . $build->id; switch ($build->getStatus()) { case 0: $class = 'bg-blue'; diff --git a/src/PHPCensor/View/User/index.phtml b/src/PHPCensor/View/User/index.phtml index 3a713545..d0b48c27 100644 --- a/src/PHPCensor/View/User/index.phtml +++ b/src/PHPCensor/View/User/index.phtml @@ -1,7 +1,7 @@
      - +
      @@ -35,18 +35,18 @@ } ?> - getEmail(); ?> + getEmail(); ?> getName()); ?> User()->getIsAdmin()): ?>
      - +
      diff --git a/src/PHPCensor/View/layout.phtml b/src/PHPCensor/View/layout.phtml index 08c8d8e3..0effb32a 100644 --- a/src/PHPCensor/View/layout.phtml +++ b/src/PHPCensor/View/layout.phtml @@ -10,31 +10,31 @@ - - - + + + - - - + + + - - - - + + + +
      - +
    @@ -139,7 +139,7 @@