本文整理汇总了PHP中TBGSettings::getMajorVer方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGSettings::getMajorVer方法的具体用法?PHP TBGSettings::getMajorVer怎么用?PHP TBGSettings::getMajorVer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGSettings
的用法示例。
在下文中一共展示了TBGSettings::getMajorVer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runCheckUpdates
/**
* check for updates
*
* @param TBGRequest $request
*/
public function runCheckUpdates(TBGRequest $request)
{
$data = json_decode(file_get_contents('http://www.thebuggenie.com/updatecheck.php'));
if (!is_object($data)) {
$this->getResponse()->setHttpStatus(500);
return $this->renderJSON(array('failed' => true, 'title' => TBGContext::getI18n()->__('Failed to check for updates'), 'message' => TBGContext::getI18n()->__('The response from The Bug Genie website was invalid')));
}
$outofdate = false;
// major
if ($data->maj > TBGSettings::getMajorVer()) {
$outofdate = true;
} elseif ($data->min > TBGSettings::getMinorVer() && $data->maj == TBGSettings::getMajorVer()) {
$outofdate = true;
} elseif ($data->rev > TBGSettings::getRevision() && $data->maj == TBGSettings::getMajorVer() && $data->min == TBGSettings::getMinorVer()) {
$outofdate = true;
}
if (!$outofdate) {
return $this->renderJSON(array('failed' => false, 'uptodate' => true, 'title' => TBGContext::getI18n()->__('The Bug Genie is up to date'), 'message' => TBGContext::getI18n()->__('The latest version is %ver%', array('%ver%' => $data->nicever))));
} else {
return $this->renderJSON(array('failed' => false, 'uptodate' => false, 'title' => TBGContext::getI18n()->__('The Bug Genie is out of date'), 'message' => TBGContext::getI18n()->__('The latest version is %ver%. Update now from www.thebuggenie.com.', array('%ver%' => $data->nicever))));
}
}
示例2: runInstallStep6
/**
* Runs the action for the sixth step of the installation
* where it finalizes the installation
*
* @param TBGRequest $request The request object
*
* @return null
*/
public function runInstallStep6(TBGRequest $request)
{
$installed_string = TBGSettings::getMajorVer() . '.' . TBGSettings::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.";
}
TBGContext::clearRoutingCache();
}
示例3: do_execute
//.........这里部分代码省略.........
$this->cliEcho('Please note: ', 'white', 'bold');
$this->cliEcho("The Bug Genie will not function properly until the .htaccess file is properly set up!\n");
} else {
$this->cliEcho("The .htaccess file was successfully set up...\n", 'green', 'bold');
}
}
} else {
$this->cliEcho("Skipping .htaccess auto-setup.");
}
if ($this->getProvidedArgument('setup_htaccess') != 'yes') {
$this->cliEcho("Press ENTER to continue ... ");
$this->pressEnterToContinue();
$this->cliEcho("\n");
}
$enable_modules = array();
if ($this->getProvidedArgument('enable_all_modules') != 'yes') {
$this->cliEcho("You will now get a list of available modules.\nTo enable the module after installation, just press ENTER.\nIf you don't want to enable the module, type \"no\".\nRemember that all these modules can be disabled/uninstalled after installation.\n\n");
}
$this->cliEcho("Enable incoming and outgoing email? ", 'white', 'bold') . $this->cliEcho('(yes): ');
$enable_modules['mailing'] = $this->getProvidedArgument('enable_all_modules') == 'yes' ? true : $this->askToDecline();
if ($this->getProvidedArgument('enable_all_modules') == 'yes') {
$this->cliEcho("Yes\n", 'yellow', 'bold');
}
$this->cliEcho("Enable communication with version control systems (i.e. svn)? ", 'white', 'bold') . $this->cliEcho('(yes): ');
$enable_modules['vcs_integration'] = $this->getProvidedArgument('enable_all_modules') == 'yes' ? true : $this->askToDecline();
if ($this->getProvidedArgument('enable_all_modules') == 'yes') {
$this->cliEcho("Yes\n", 'yellow', 'bold');
}
$enable_modules['publish'] = true;
$this->cliEcho("\n");
$this->cliEcho("Creating tables ...\n", 'white', 'bold');
$tables_path = THEBUGGENIE_CORE_PATH . 'classes' . DIRECTORY_SEPARATOR . 'B2DB' . DIRECTORY_SEPARATOR;
TBGContext::addAutoloaderClassPath($tables_path);
$tables_path_handle = opendir($tables_path);
$tables_created = array();
while ($table_class_file = readdir($tables_path_handle)) {
if (($tablename = mb_substr($table_class_file, 0, mb_strpos($table_class_file, '.'))) != '') {
\b2db\Core::getTable($tablename)->create();
$this->cliEcho("Creating table {$tablename}\n", 'white', 'bold');
}
}
$this->cliEcho("\n");
$this->cliEcho("All tables successfully created...\n\n", 'green', 'bold');
$this->cliEcho("Setting up initial scope... \n", 'white', 'bold');
TBGContext::reinitializeI18n('en_US');
$scope = new TBGScope();
$scope->setName('The default scope');
$scope->addHostname('*');
$scope->setEnabled();
TBGContext::setScope($scope);
$scope->save();
TBGSettings::saveSetting('language', 'en_US');
$this->cliEcho("Initial scope setup successfully... \n\n", 'green', 'bold');
$this->cliEcho("Setting up modules... \n", 'white', 'bold');
try {
foreach ($enable_modules as $module => $install) {
if ((bool) $install && file_exists(THEBUGGENIE_MODULES_PATH . $module . DS . 'module')) {
$this->cliEcho("Installing {$module}... \n");
TBGModule::installModule($module);
$this->cliEcho("Module {$module} installed successfully...\n", 'green');
}
}
$this->cliEcho("\n");
$this->cliEcho("All modules installed successfully...\n", 'green', 'bold');
$this->cliEcho("\n");
$this->cliEcho("Finishing installation... \n", 'white', 'bold');
$installed_string = TBGSettings::getMajorVer() . '.' . TBGSettings::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");
}