Esempio n. 1
0
 /**
  * コンストラクタ
  * @param $name 設定名
  * @param $autoupdate 自動更新するか
  */
 public function __construct($name, $autoupdate = false)
 {
     $this->name = $name;
     $this->page = self::CONFIG_PAGE_PREFIX . $name;
     //		$this->cache_name = self::CACHE_PREFIX.md5($name);
     $this->wiki = FileFactory::Wiki($this->page);
     $this->autoupdate = $autoupdate;
     $this->read();
 }
Esempio n. 2
0
 public function __construct($page)
 {
     global $cycle, $maxage;
     $this->page = $page;
     // バックアップの頻度
     //$this->cycle = 0;
     $this->cycle = !empty($cycle) ? 60 * 60 * $cycle : self::BACKUP_INTERVAL;
     // バックアップの上限個数
     $this->maxage = $maxage;
     // 以下はSplFileInfoの派生クラス
     $this->wiki = FileFactory::Wiki($this->page);
     $this->backup = FileFactory::Backup($this->page);
     // バックアップの世代間の区切りの正規表現
     $this->splitter_reglex = '/^(' . preg_quote(self::SPLITTER) . '\\s\\d+(\\s(\\d+)|))$/';
 }
Esempio n. 3
0
 /**
  * 削除履歴を生成
  * @global string $whatsdeleted
  * @param string $deleted 削除したページ
  * @return type
  */
 public static function updateRecentDeleted($page)
 {
     global $whatsdeleted;
     // 隠されたページの場合削除履歴を付けない
     if (Factory::Wiki($page)->isHidden()) {
         return;
     }
     // 新たに削除されるページ名
     $_page = '[[' . str_replace(''', '\'', Utility::htmlsc($page)) . ']]';
     // 削除履歴ページ
     $delated_wiki = FileFactory::Wiki($whatsdeleted);
     $lines = array();
     // 削除履歴を確認する
     $deletedLines = $delated_wiki->get();
     if (is_array($deletedLines)) {
         foreach ($deletedLines as $line) {
             if (preg_match('/^-(.+) - (\\[\\[.+\\]\\])$/', $line, $matches)) {
                 $lines[$matches[2]] = $line;
             }
         }
     }
     // 削除されるページ名と同じページが存在した時にそこの行を削除する
     if (isset($lines[$_page])) {
         unset($lines[$_page]);
     }
     // 削除履歴に追記
     array_unshift($lines, '- &epoch(' . UTIME . '); - ' . $_page);
     array_unshift($lines, '#norelated');
     // 履歴の最大記録数を制限
     $lines = array_splice($lines, 0, self::RECENT_MAX_SHOW_PAGES);
     // 削除履歴を付ける(この時に最終更新のキャッシュも自動更新される)
     $delated_wiki->set(array_values($lines));
 }
Esempio n. 4
0
 /**
  * コンストラクタ
  * @param string $page ページ名
  */
 public function __construct($page)
 {
     if (!is_string($page)) {
         throw new Exception('Wiki.php : invalied page name type.');
     }
     // 空白のページが作成されないようにする
     $page = trim($page);
     if (empty($page)) {
         throw new Exception('Wiki.php : page name is empty.');
     }
     // page#idという形式で入力が合った場合、ページ名とIDで分割する
     if (strpos($page, '#') !== false) {
         // #の手前をWikiページとして処理
         $this->page = strtok($page, '#');
         // #以降をidとする。
         $this->id = substr(strrchr($page, '#'), 1);
     } else {
         // 通常動作
         $this->page = $page;
     }
     // 以下はSplFileInfoの派生クラス
     $this->wiki = FileFactory::Wiki($this->page);
 }