当前位置: 首页>>代码示例>>PHP>>正文


PHP TBGContext::isInstallmode方法代码示例

本文整理汇总了PHP中TBGContext::isInstallmode方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::isInstallmode方法的具体用法?PHP TBGContext::isInstallmode怎么用?PHP TBGContext::isInstallmode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TBGContext的用法示例。


在下文中一共展示了TBGContext::isInstallmode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testInstallMode

 /**
  * @covers TBGContext::isInstallmode
  * @covers TBGContext::checkInstallMode
  */
 public function testInstallMode()
 {
     TBGContext::checkInstallMode();
     if (file_exists(THEBUGGENIE_PATH . 'installed')) {
         $this->assertFalse(TBGContext::isInstallmode());
     } else {
         $this->assertTrue(TBGContext::isInstallmode());
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:13,代码来源:TBGContextTest.php

示例2: hasCachedRoutes

 public function hasCachedRoutes()
 {
     if ($this->has_cached_routes === null) {
         if (TBGContext::isInstallmode()) {
             $this->has_cached_routes = false;
         } else {
             $this->has_cached_routes = TBGCache::has(TBGCache::KEY_ROUTES_CACHE);
             if ($this->has_cached_routes) {
                 TBGLogging::log('Routes are cached', 'routing');
             } else {
                 TBGLogging::log('Routes are not cached', 'routing');
             }
         }
     }
     return $this->has_cached_routes;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:16,代码来源:TBGRouting.class.php

示例3: do_execute

 public function do_execute()
 {
     if (TBGContext::isInstallmode()) {
         $this->cliEcho("The Bug Genie is not installed\n", 'red');
     } else {
         $this->cliEcho("Finding times to fix\n", 'white', 'bold');
         $issuetimes = TBGIssueSpentTimesTable::getTable()->getAllSpentTimesForFixing();
         $error_issues = array();
         foreach ($issuetimes as $issue_id => $times) {
             if (count($times) > 1) {
                 $this->cliEcho("Fixing times spent for issue ID {$issue_id}, " . count($times) . " entries\n");
                 $prev_times = array('hours' => 0, 'days' => 0, 'weeks' => 0, 'months' => 0, 'points' => 0);
                 foreach ($times as $k => $row) {
                     if ($row[TBGIssueSpentTimesTable::SPENT_DAYS] < $prev_times['days'] || $row[TBGIssueSpentTimesTable::SPENT_HOURS] < $prev_times['hours'] || $row[TBGIssueSpentTimesTable::SPENT_WEEKS] < $prev_times['weeks'] || $row[TBGIssueSpentTimesTable::SPENT_MONTHS] < $prev_times['months'] || $row[TBGIssueSpentTimesTable::SPENT_POINTS] < $prev_times['points']) {
                         $error_issues[] = $issue_id;
                     } else {
                         TBGIssueSpentTimesTable::getTable()->fixRow($row, $prev_times);
                         $prev_times['points'] += $row[TBGIssueSpentTimesTable::SPENT_POINTS];
                         $prev_times['hours'] += $row[TBGIssueSpentTimesTable::SPENT_HOURS];
                         $prev_times['days'] += $row[TBGIssueSpentTimesTable::SPENT_DAYS];
                         $prev_times['weeks'] += $row[TBGIssueSpentTimesTable::SPENT_WEEKS];
                         $prev_times['months'] += $row[TBGIssueSpentTimesTable::SPENT_MONTHS];
                     }
                 }
             }
         }
         foreach (TBGIssueSpentTimesTable::getTable()->getAllSpentTimesForFixing() as $issue_id => $times) {
             foreach ($times as $row) {
                 TBGIssueSpentTimesTable::getTable()->fixHours($row);
             }
             TBGIssuesTable::getTable()->fixHours($issue_id);
         }
         if (count($error_issues) > 0) {
             $this->cliEcho("\n");
             $this->cliEcho("All spent times have been attempted fixed, but there were some issues that could not be fixed automatically!\n");
             $this->cliEcho("This happens if there has been adjustments in time spent, lowering the value for spent points, hours, days, weeks or months.\n\n");
             $this->cliEcho("You should fix the issues manually (issue ids corresponding to issue_ids in the timesspent table): ");
             $this->cliEcho(join(', ', $error_issues) . "\n\n");
             $this->cliEcho("Spent times fixed!\n\n", 'green');
         } else {
             $this->cliEcho("All spent times fixed successfully!\n\n", 'green');
         }
         $this->cliEcho("IMPORTANT: Don't run this task again!\n", 'white', 'bold');
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:45,代码来源:CliMainFixTimesSpent.class.php

示例4: get

 public static function get($name, $module = 'core', $scope = null, $uid = 0)
 {
     if (TBGContext::isInstallmode() && !TBGContext::getScope() instanceof TBGScope) {
         return null;
     }
     if ($scope instanceof TBGScope) {
         $scope = $scope->getID();
     }
     if (!TBGContext::getScope() instanceof TBGScope) {
         throw new Exception('The Bug Genie is not installed correctly');
     }
     if ($scope != TBGContext::getScope()->getID() && $scope !== null) {
         $setting = self::_loadSetting($name, $module, $scope);
         return $setting[$uid];
     }
     if (self::$_settings === null) {
         self::loadSettings();
     }
     if ($uid > 0 && !array_key_exists($uid, self::$_loadedsettings)) {
         self::loadSettings($uid);
     }
     if (!is_array(self::$_settings) || !array_key_exists($module, self::$_settings)) {
         return null;
     }
     if (!array_key_exists($name, self::$_settings[$module])) {
         return null;
         //self::$_settings[$name] = self::_loadSetting($name, $module, TBGContext::getScope()->getID());
     }
     if ($uid !== 0 && array_key_exists($uid, self::$_settings[$module][$name])) {
         return self::$_settings[$module][$name][$uid];
     } else {
         if (!array_key_exists($uid, self::$_settings[$module][$name])) {
             return null;
         }
         return self::$_settings[$module][$name][$uid];
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:37,代码来源:TBGSettings.class.php

示例5: getCharset

 public function getCharset()
 {
     if (TBGContext::isInstallmode()) {
         return $this->_charset;
     }
     return TBGSettings::get('charset') != '' ? TBGSettings::get('charset') : $this->_charset;
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:7,代码来源:TBGI18n.class.php

示例6: do_execute

 public function do_execute()
 {
     if (TBGContext::isInstallmode()) {
         $this->cliEcho("Create module\n", 'white', 'bold');
         $this->cliEcho("The Bug Genie is not installed\n", 'red');
     } else {
         $module_name = ucfirst($this->getProvidedArgument('module_name'));
         $module_key = strtolower($module_name);
         $module_description = "Autogenerated module {$module_name}";
         $this->cliEcho("Initializing empty module ");
         $this->cliEcho("{$module_key}\n", 'white', 'bold');
         $this->cliEcho("Checking that the module doesn't exist ... ");
         if (file_exists(THEBUGGENIE_MODULES_PATH . $module_key)) {
             $this->cliEcho("fail\n", 'red');
             $this->cliEcho("A module with this name already exists\n", 'red');
             return false;
         } else {
             $this->cliEcho("OK\n", 'green', 'bold');
         }
         $this->cliEcho("Checking for conflicting classnames ... ");
         if (class_exists($module_name)) {
             $this->cliEcho("fail\n", 'red');
             $this->cliEcho("A class with this name already exists\n", 'red');
             return false;
         } else {
             $this->cliEcho("OK\n", 'green', 'bold');
         }
         $this->cliEcho("Checking that the module path is writable ... ");
         if (!is_writable(THEBUGGENIE_MODULES_PATH)) {
             $this->cliEcho("fail\n", 'red');
             $this->cliEcho("Module path isn't writable\n\n", 'red');
             $this->cliEcho("Please make sure that the following path is writable: \n");
             $this->cliEcho(THEBUGGENIE_MODULES_PATH, 'cyan');
             return false;
         } else {
             $this->cliEcho("OK\n", 'green', 'bold');
         }
         $this->cliEcho("\nCreating module directory structure ... \n", 'white', 'bold');
         $this_module_path = THEBUGGENIE_MODULES_PATH . $module_key . DS;
         mkdir(THEBUGGENIE_MODULES_PATH . $module_key);
         $this->cliEcho('modules' . DS . "{$module_key}\n");
         mkdir($this_module_path . 'classes');
         $this->cliEcho('modules' . DS . $module_key . DS . "classes\n");
         mkdir($this_module_path . 'classes' . DS . 'cli');
         $this->cliEcho('modules' . DS . $module_key . DS . 'classes' . DS . "cli\n");
         mkdir($this_module_path . 'templates');
         $this->cliEcho('modules' . DS . $module_key . DS . "templates\n");
         $this->cliEcho("... ", 'white', 'bold');
         $this->cliEcho("OK\n", 'green', 'bold');
         $this->cliEcho("\nCreating module files ... \n", 'white', 'bold');
         file_put_contents($this_module_path . "class", "{$module_name}|0.1");
         $this->cliEcho('modules' . DS . $module_key . DS . "class\n");
         file_put_contents($this_module_path . "module", $module_description);
         $this->cliEcho('modules' . DS . $module_key . DS . "module\n");
         $module_class_template = file_get_contents(THEBUGGENIE_MODULES_PATH . "main" . DS . "fixtures" . DS . "emptymoduleclass");
         $module_class_content = str_replace(array('%module_key%', '%module_name%', '%module_description%'), array($module_key, $module_name, $module_description), $module_class_template);
         file_put_contents($this_module_path . "classes" . DS . $module_name . ".class.php", $module_class_content);
         $this->cliEcho("modules" . DS . $module_key . DS . "classes" . DS . $module_name . ".class.php\n");
         $module_actions_class_template = file_get_contents(THEBUGGENIE_MODULES_PATH . "main" . DS . "fixtures" . DS . "emptymoduleactionsclass");
         $module_actions_class_content = str_replace(array('%module_key%', '%module_name%', '%module_description%'), array($module_key, $module_name, $module_description), $module_actions_class_template);
         file_put_contents($this_module_path . "classes" . DS . "actions.class.php", $module_actions_class_content);
         $this->cliEcho("modules" . DS . $module_key . DS . "classes" . DS . "actions.class.php\n");
         $module_actioncomponents_class_template = file_get_contents(THEBUGGENIE_MODULES_PATH . "main" . DS . "fixtures" . DS . "emptymoduleactioncomponentsclass");
         $module_actioncomponents_class_content = str_replace(array('%module_key%', '%module_name%', '%module_description%'), array($module_key, $module_name, $module_description), $module_actioncomponents_class_template);
         file_put_contents($this_module_path . "classes" . DS . "actioncomponents.class.php", $module_actioncomponents_class_content);
         $this->cliEcho("modules" . DS . $module_key . DS . "classes" . DS . "actioncomponents.class.php\n");
         file_put_contents($this_module_path . "templates" . DS . "index.html.php", "{$module_name} frontpage");
         $this->cliEcho("modules" . DS . $module_key . DS . "templates" . DS . "index.html.php\n");
         $this->cliEcho("... ", 'white', 'bold');
         $this->cliEcho("OK\n\n", 'green', 'bold');
         $this->cliEcho("The module was created successfully!\n", 'green');
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:73,代码来源:CliMainCreateModule.class.php

示例7: do_execute

 public function do_execute()
 {
     if (TBGContext::isInstallmode()) {
         $this->cliEcho("Manage modules\n", 'white', 'bold');
         $this->cliEcho("The Bug Genie is not installed\n", 'red');
     } else {
         switch ($this->getProvidedArgument('action')) {
             case 'list_installed':
                 $this->_listInstalled();
                 break;
             case 'list_available':
                 $this->_listAvailable();
                 break;
             case 'install':
                 $this->_installModule($this->getProvidedArgument('module_name'));
                 break;
             case 'uninstall':
                 $this->_uninstallModule($this->getProvidedArgument('module_name'));
                 break;
             default:
                 $this->cliEcho("Unknown action\n", 'red');
         }
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:24,代码来源:CliMainManageModules.class.php


注:本文中的TBGContext::isInstallmode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。