/**
  * @see Cronjob::execute()
  */
 public function execute($data)
 {
     require_once WCF_DIR . 'lib/data/feed/FeedReaderSource.class.php';
     $sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_feed_source\n\t\t\tWHERE\tlastUpdate + updateCycle < " . TIME_NOW;
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $source = new FeedReaderSource($row);
         $source->update();
     }
 }
Пример #2
0
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->os = PHP_OS;
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $this->webserver = $_SERVER['SERVER_SOFTWARE'];
     }
     $this->sqlVersion = WCF::getDB()->getVersion();
     $this->sqlType = WCF::getDB()->getDBType();
     $this->readLoad();
     $this->readStat();
     // updates
     if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) {
         require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php';
         $this->updates = PackageUpdate::getAvailableUpdates();
     }
     // news
     if (false) {
         $this->news = FeedReaderSource::getEntries(5);
         foreach ($this->news as $key => $news) {
             $this->news[$key]['description'] = preg_replace('/href="(.*?)"/e', '\'href="' . RELATIVE_WCF_DIR . 'acp/dereferrer.php?url=\'.rawurlencode(\'$1\').\'" class="externalURL"\'', $news['description']);
         }
     } else {
         $this->news = array();
     }
 }
 /**
  * Gets a list of available news.
  */
 protected function readNews()
 {
     $this->news = FeedReaderSource::getEntries(5);
     foreach ($this->news as $key => $news) {
         $this->news[$key]['description'] = preg_replace('/href="(.*?)"/e', '\'href="' . RELATIVE_WCF_DIR . 'acp/dereferrer.php?url=\'.rawurlencode(\'$1\').\'" class="externalURL"\'', $news['description']);
         // kick woltlab news
         if (preg_match('/woltlab.(com|de)/i', $this->news[$key]['link'])) {
             unset($this->news[$key]);
         }
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->os = PHP_OS;
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $this->webserver = $_SERVER['SERVER_SOFTWARE'];
     }
     $this->sqlVersion = WCF::getDB()->getVersion();
     $this->sqlType = WCF::getDB()->getDBType();
     $this->readLoad();
     $this->readStat();
     // updates
     if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) {
         require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php';
         $updates = PackageUpdate::getAvailableUpdates();
         //print_r($updates);exit;
         foreach ($updates as $update) {
             $versions = array_reverse($update['versions']);
             // find newest minor update
             $i = 0;
             $currentVersionStatus = preg_match('/(alpha|beta|RC)/i', $update['packageVersion']) ? 'unstable' : 'stable';
             foreach ($versions as $version) {
                 $newVersionStatus = preg_match('/(alpha|beta|RC)/i', $version['packageVersion']) ? 'unstable' : 'stable';
                 if ($currentVersionStatus == $newVersionStatus && preg_match('/^(\\d\\.\\d)/', $update['packageVersion'], $match1) && preg_match('/^(\\d\\.\\d)/', $version['packageVersion'], $match2)) {
                     if ($match1[1] == $match2[1]) {
                         $minorUpdate = $update;
                         $minorUpdate['version'] = $version;
                         $this->minorUpdates[] = $minorUpdate;
                         if ($i != 0) {
                             $this->majorUpdates[] = $update;
                         }
                         continue 2;
                     }
                 }
                 $i++;
             }
             $this->majorUpdates[] = $update;
         }
     }
     // news
     $this->news = FeedReaderSource::getEntries(5);
     foreach ($this->news as $key => $news) {
         $this->news[$key]['description'] = preg_replace_callback('/href="(.*?)"/', array('IndexPage', 'parseNewsFeedCallback'), $news['description']);
     }
 }