Example #1
0
 public function __construct(OW_Database $dbo)
 {
     $this->dbo = $dbo;
     $result = $this->dbo->queryForList("SELECT `key`, `content` FROM `" . $this->getCacheTableName() . "` WHERE `expireTimestamp` >= :ct AND `instantLoad` = 1", array('ct' => time()));
     $this->loadedItems = array();
     foreach ($result as $item) {
         $this->loadedItems[$item['key']] = $item['content'];
     }
 }
Example #2
0
 /**
  * Updates all plugins
  * 
  * @return int
  * @throws LogicException
  * @throws LogicUpToDateException
  */
 public function updateAllPlugins()
 {
     $result = $this->db->queryForList("SELECT * FROM `{$this->dbPrefix}base_plugin` WHERE `update` = :statusVal", array("statusVal" => BOL_PluginDao::UPDATE_VAL_MANUAL_UPDATE));
     // plugin not found
     if (empty($result)) {
         throw new LogicException("No plugins for update");
     }
     $this->setMaintenance(true);
     $successCount = 0;
     $failCount = 0;
     foreach ($result as $plugin) {
         if (!$this->updatePlugin($plugin)) {
             $failCount++;
         } else {
             $successCount++;
         }
     }
     $this->setMaintenance(false);
     if ($successCount <= 0) {
         throw new LogicUpToDateException("All plugins are up to date");
     }
     $this->setDevMode();
     return $successCount;
 }