本文整理汇总了PHP中thebuggenie\core\framework\Settings::getMajorVer方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::getMajorVer方法的具体用法?PHP Settings::getMajorVer怎么用?PHP Settings::getMajorVer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Settings
的用法示例。
在下文中一共展示了Settings::getMajorVer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInstallMode
/**
* @covers \thebuggenie\core\framework\Context::isInstallmode
* @covers \thebuggenie\core\framework\Context::checkInstallMode
*/
public function testInstallMode()
{
$installed_file = THEBUGGENIE_PATH . 'installed';
if (file_exists($installed_file)) {
unlink($installed_file);
}
\thebuggenie\core\framework\Context::checkInstallMode();
$this->assertTrue(\thebuggenie\core\framework\Context::isInstallmode());
file_put_contents($installed_file, \thebuggenie\core\framework\Settings::getMajorVer() . "." . \thebuggenie\core\framework\Settings::getMinorVer() . "." . \thebuggenie\core\framework\Settings::getRevision() . ", installed today");
\thebuggenie\core\framework\Context::checkInstallMode();
$this->assertFalse(\thebuggenie\core\framework\Context::isInstallmode());
}
示例2: runCheckUpdates
/**
* check for updates
*
* @param framework\Request $request
*/
public function runCheckUpdates(framework\Request $request)
{
$data = json_decode(file_get_contents('http://www.thebuggenie.com/updatecheck.php'));
if (!is_object($data)) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Failed to check for updates'), 'message' => framework\Context::getI18n()->__('The response from The Bug Genie website was invalid')));
}
$outofdate = false;
// major
if ($data->maj > framework\Settings::getMajorVer()) {
$outofdate = true;
} elseif ($data->min > framework\Settings::getMinorVer() && $data->maj == framework\Settings::getMajorVer()) {
$outofdate = true;
} elseif ($data->rev > framework\Settings::getRevision() && $data->maj == framework\Settings::getMajorVer() && $data->min == framework\Settings::getMinorVer()) {
$outofdate = true;
}
if (!$outofdate) {
return $this->renderJSON(array('uptodate' => true, 'title' => framework\Context::getI18n()->__('The Bug Genie is up to date'), 'message' => framework\Context::getI18n()->__('The latest version is %ver', array('%ver' => $data->nicever))));
} else {
return $this->renderJSON(array('uptodate' => false, 'title' => framework\Context::getI18n()->__('The Bug Genie is out of date'), 'message' => framework\Context::getI18n()->__('The latest version is %ver. Update now from www.thebuggenie.com.', array('%ver' => $data->nicever))));
}
}
示例3: runInstallStep6
/**
* Runs the action for the sixth step of the installation
* where it finalizes the installation
*
* @param framework\Request $request The request object
*
* @return null
*/
public function runInstallStep6(framework\Request $request)
{
$installed_string = framework\Settings::getMajorVer() . '.' . framework\Settings::getMinorVer() . ', installed ' . date('d.m.Y H:i');
if (file_put_contents(THEBUGGENIE_PATH . 'installed', $installed_string) === false) {
$this->error = "Couldn't write to the main directory. Please create the file " . THEBUGGENIE_PATH . "installed manually, with the following content: \n" . $installed_string;
}
if (file_exists(THEBUGGENIE_PATH . 'upgrade') && !unlink(THEBUGGENIE_PATH . 'upgrade')) {
$this->error = "Couldn't remove the file " . THEBUGGENIE_PATH . "upgrade. Please remove this file manually.";
}
framework\Context::clearRoutingCache();
}
示例4: do_execute
//.........这里部分代码省略.........
$this->cliEcho("Permission denied when trying to save the [main folder]/thebuggenie/.user.ini\n", 'red', 'bold');
$this->cliEcho("You will have to set up the .user.ini file yourself. See the README file for more information.\n", 'white', 'bold');
$this->cliEcho('Please note: ', 'white', 'bold');
$this->cliEcho("If you're using PHP-FPM, The Bug Genie might not function properly until the .user.ini file is properly set up\n");
} else {
$content = file_get_contents(THEBUGGENIE_CORE_PATH . 'templates/htaccess.template');
file_put_contents(THEBUGGENIE_PATH . 'thebuggenie/.user.ini', $content);
if (file_get_contents(THEBUGGENIE_PATH . 'thebuggenie/.user.ini') != $content) {
$this->cliEcho("Permission denied when trying to save the [main folder]/thebuggenie/.user.ini\n", 'red', 'bold');
$this->cliEcho("You will have to set up the .user.ini file yourself. See the README file for more information.\n", 'white', 'bold');
$this->cliEcho('Please note: ', 'white', 'bold');
$this->cliEcho("If you're using PHP-FPM, The Bug Genie might not function properly until the .user.ini file is properly set up\n");
} else {
$this->cliEcho("The .user.ini file was successfully set up...\n", 'green', 'bold');
}
}
} else {
$this->cliEcho("Skipping .htaccess and .user.ini auto-setup.");
}
if ($this->getProvidedArgument('setup_htaccess') != 'yes') {
$this->cliEcho("Press ENTER to continue ... ");
$this->pressEnterToContinue();
$this->cliEcho("\n");
}
$this->cliEcho("\n");
$this->cliEcho("Creating tables ...\n", 'white', 'bold');
$b2db_entities_path = THEBUGGENIE_CORE_PATH . 'entities' . DS . 'tables' . DS;
$tables_created = array();
foreach (scandir($b2db_entities_path) as $tablefile) {
if (in_array($tablefile, array('.', '..'))) {
continue;
}
if (($tablename = mb_substr($tablefile, 0, mb_strpos($tablefile, '.'))) != '') {
$tablename = "\\thebuggenie\\core\\entities\\tables\\{$tablename}";
$reflection = new \ReflectionClass($tablename);
$docblock = $reflection->getDocComment();
$annotationset = new \b2db\AnnotationSet($docblock);
if ($annotationset->hasAnnotation('Table')) {
\b2db\Core::getTable($tablename)->create();
\b2db\Core::getTable($tablename)->createIndexes();
$tables_created[] = $tablename;
}
}
}
$this->cliEcho("\n");
$this->cliEcho("All tables successfully created...\n\n", 'green', 'bold');
$this->cliEcho("Setting up initial scope... \n", 'white', 'bold');
\thebuggenie\core\framework\Context::reinitializeI18n('en_US');
$scope = new \thebuggenie\core\entities\Scope();
$scope->setName('The default scope');
$scope->addHostname('*');
$scope->setEnabled();
\thebuggenie\core\framework\Context::setScope($scope);
$scope->save();
\thebuggenie\core\framework\Settings::saveSetting('language', 'en_US');
$this->cliEcho("Initial scope setup successfully... \n\n", 'green', 'bold');
$this->cliEcho("Setting up modules... \n", 'white', 'bold');
try {
foreach (array('publish', 'mailing', 'vcs_integration') as $module) {
$this->cliEcho("Installing {$module}... \n");
\thebuggenie\core\entities\Module::installModule($module);
}
$this->cliEcho("\n");
$this->cliEcho("All modules installed successfully...\n", 'green', 'bold');
$this->cliEcho("\n");
$this->cliEcho("Finishing installation... \n", 'white', 'bold');
$installed_string = \thebuggenie\core\framework\Settings::getMajorVer() . '.' . \thebuggenie\core\framework\Settings::getMinorVer() . ', installed ' . date('d.m.Y H:i');
if (file_exists(THEBUGGENIE_PATH . 'installed') && !is_writable(THEBUGGENIE_PATH . 'installed') || !file_exists(THEBUGGENIE_PATH . 'installed') && !is_writable(THEBUGGENIE_PATH)) {
$this->cliEcho("\n");
$this->cliEcho("Could not create the 'installed' file.\n", 'red', 'bold');
$this->cliEcho("Please create the file ");
$this->cliEcho(THEBUGGENIE_PATH . "installed\n", 'white', 'bold');
$this->cliEcho("with the following line inside:\n");
$this->cliEcho($installed_string, 'blue', 'bold');
$this->cliEcho("\n");
$this->cliEcho("This can be done by running the following command when installation has finished:\n");
$this->cliEcho('echo "' . $installed_string . '" > ' . THEBUGGENIE_PATH . 'installed', 'white', 'bold');
$this->cliEcho("\n");
$this->cliEcho("Press ENTER to continue ... ");
$this->pressEnterToContinue();
$this->cliEcho("\n");
$this->cliEcho("\n");
} else {
file_put_contents(THEBUGGENIE_PATH . 'installed', $installed_string);
}
$this->cliEcho("The installation was completed successfully!\n", 'green', 'bold');
$this->cliEcho("\nTo use The Bug Genie, access http://example.com" . $url_subdir . "index.php with a web-browser.\n");
$this->cliEcho("The default username is ") . $this->cliEcho('Administrator') . $this->cliEcho(' and the password is ') . $this->cliEcho('admin');
$this->cliEcho("\n\nFor support, please visit ") . $this->cliEcho('http://www.thebuggenie.com/', 'blue', 'underline');
$this->cliEcho("\n");
} catch (\Exception $e) {
throw new \Exception("Could not install the {$module} module:\n" . $e->getMessage());
}
}
} catch (\Exception $e) {
$this->cliEcho("\n\nThe installation was interrupted\n", 'red');
$this->cliEcho($e->getMessage() . "\n");
}
$this->cliEcho("\n");
}