• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP HTMLCacheUpdate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: recordUpload2

 /**
  * Record a file upload in the upload log and the image table
  */
 function recordUpload2($oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null)
 {
     if (is_null($user)) {
         global $wgUser;
         $user = $wgUser;
     }
     $dbw = $this->repo->getMasterDB();
     $dbw->begin();
     if (!$props) {
         $props = $this->repo->getFileProps($this->getVirtualUrl());
     }
     $props['description'] = $comment;
     $props['user'] = $user->getId();
     $props['user_text'] = $user->getName();
     $props['timestamp'] = wfTimestamp(TS_MW);
     $this->setProps($props);
     // Delete thumbnails and refresh the metadata cache
     $this->purgeThumbnails();
     $this->saveToCache();
     SquidUpdate::purge(array($this->getURL()));
     /* Wikia change begin - @author: Marooned, see RT#44185 */
     global $wgLogo;
     if ($this->url == $wgLogo) {
         SquidUpdate::purge(array($this->url));
     }
     /* Wikia change end */
     // Fail now if the file isn't there
     if (!$this->fileExists) {
         wfDebug(__METHOD__ . ": File " . $this->getPath() . " went missing!\n");
         return false;
     }
     $reupload = false;
     if ($timestamp === false) {
         $timestamp = $dbw->timestamp();
     }
     # Test to see if the row exists using INSERT IGNORE
     # This avoids race conditions by locking the row until the commit, and also
     # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
     $dbw->insert('image', array('img_name' => $this->getName(), 'img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->media_type, 'img_major_mime' => $this->major_mime, 'img_minor_mime' => $this->minor_mime, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), 'img_metadata' => $this->metadata, 'img_sha1' => $this->sha1), __METHOD__, 'IGNORE');
     if ($dbw->affectedRows() == 0) {
         $reupload = true;
         # Collision, this is an update of a file
         # Insert previous contents into oldimage
         $dbw->insertSelect('oldimage', 'image', array('oi_name' => 'img_name', 'oi_archive_name' => $dbw->addQuotes($oldver), 'oi_size' => 'img_size', 'oi_width' => 'img_width', 'oi_height' => 'img_height', 'oi_bits' => 'img_bits', 'oi_timestamp' => 'img_timestamp', 'oi_description' => 'img_description', 'oi_user' => 'img_user', 'oi_user_text' => 'img_user_text', 'oi_metadata' => 'img_metadata', 'oi_media_type' => 'img_media_type', 'oi_major_mime' => 'img_major_mime', 'oi_minor_mime' => 'img_minor_mime', 'oi_sha1' => 'img_sha1'), array('img_name' => $this->getName()), __METHOD__);
         # Update the current image row
         $dbw->update('image', array('img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->media_type, 'img_major_mime' => $this->major_mime, 'img_minor_mime' => $this->minor_mime, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), 'img_metadata' => $this->metadata, 'img_sha1' => $this->sha1), array('img_name' => $this->getName()), __METHOD__);
     } else {
         # This is a new file
         # Update the image count
         $site_stats = $dbw->tableName('site_stats');
         $dbw->query("UPDATE {$site_stats} SET ss_images=ss_images+1", __METHOD__);
     }
     # Commit the transaction now, in case something goes wrong later
     # The most important thing is that files don't get lost, especially archives
     $dbw->commit();
     # Invalidate cache for all pages using this file
     $update = new HTMLCacheUpdate($this->getTitle(), 'imagelinks');
     $update->doUpdate();
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:63,代码来源:WikiaNoArticleLocalFile.class.php


示例2: updateSourceWLH

/**
 * Callback function to update what-links-here
 * @return bool must return true or other hooks don't get called
 */
function updateSourceWLH(&$article, &$user, &$text, &$summary, $minor, $dummy1, $dummy2, &$flags)
{
    $ns = $article->getTitle()->getNamespace();
    if ($ns == NS_SOURCE) {
        // update people and families that link to this source, because source citation could have changed
        $u = new HTMLCacheUpdate($article->getTitle(), 'pagelinks');
        $u->doUpdate();
    }
    return true;
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:14,代码来源:Source.php


示例3: exit

    exit(1);
}
if ($revision) {
    // Attach the latest revision to the page...
    $wasnew = $article->updateIfNewerOn($dbw, $revision, $previousRevId);
    if ($newid || $wasnew) {
        // Update site stats, link tables, etc
        $article->createUpdates($revision);
    }
    if ($newid) {
        Article::onArticleCreate($page);
    } else {
        Article::onArticleEdit($page);
    }
    if ($page->getNamespace() == NS_IMAGE) {
        $update = new HTMLCacheUpdate($page, 'imagelinks');
        $update->doUpdate();
    }
} else {
    // Revision couldn't be created. This is very weird
    print "We got an unknown error\n";
    exit(1);
}
# Now that it's safely stored, take it out of the archive
$dbw->delete('archive', array('ar_namespace' => $page->getNamespace(), 'ar_title' => $page->getDBkey(), $oldones), __METHOD__);
print $page->getPrefixedText();
if ($restored) {
    print "\n";
} else {
    print " FAILED\n";
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:restoreOn.php


示例4: invalidateProperties

 /**
  * Invalidate any necessary link lists related to page property changes
  * @param array $changed
  */
 private function invalidateProperties($changed)
 {
     global $wgPagePropLinkInvalidations;
     foreach ($changed as $name => $value) {
         if (isset($wgPagePropLinkInvalidations[$name])) {
             $inv = $wgPagePropLinkInvalidations[$name];
             if (!is_array($inv)) {
                 $inv = array($inv);
             }
             foreach ($inv as $table) {
                 $update = new HTMLCacheUpdate($this->mTitle, $table);
                 $update->doUpdate();
             }
         }
     }
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:20,代码来源:LinksUpdate.php


示例5: touchLinks

 /**
  * Update page_touched timestamps and send squid purge messages for
  * pages linking to this title. May be sent to the job queue depending
  * on the number of links. Typically called on create and delete.
  */
 public function touchLinks()
 {
     $u = new HTMLCacheUpdate($this, 'pagelinks');
     $u->doUpdate();
     if ($this->getNamespace() == NS_CATEGORY) {
         $u = new HTMLCacheUpdate($this, 'categorylinks');
         $u->doUpdate();
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:14,代码来源:Title.php


示例6: touch

 function touch(&$title)
 {
     wfProfileIn(__METHOD__);
     $update = new HTMLCacheUpdate($title, 'imagelinks');
     $update->doUpdate();
     wfProfileOut(__METHOD__);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:BadImage.page.php


示例7: doPurge

 /**
  * Override handling of action=purge
  */
 function doPurge()
 {
     $this->img = new Image($this->mTitle);
     if ($this->img->exists()) {
         wfDebug("ImagePage::doPurge purging " . $this->img->getName() . "\n");
         $update = new HTMLCacheUpdate($this->mTitle, 'imagelinks');
         $update->doUpdate();
         $this->img->purgeCache();
     } else {
         wfDebug("ImagePage::doPurge no image\n");
     }
     parent::doPurge();
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:16,代码来源:ImagePage.php


示例8: undeleteRevisions


//.........这里部分代码省略.........
         # Have to create a new article...
         $makepage = true;
         $previousRevId = 0;
         $previousTimestamp = 0;
     }
     $oldWhere = array('ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey());
     if (!$restoreAll) {
         $oldWhere['ar_timestamp'] = array_map(array(&$dbw, 'timestamp'), $timestamps);
     }
     $fields = array('ar_rev_id', 'ar_text', 'ar_comment', 'ar_user', 'ar_user_text', 'ar_timestamp', 'ar_minor_edit', 'ar_flags', 'ar_text_id', 'ar_deleted', 'ar_page_id', 'ar_len', 'ar_sha1');
     if ($this->config->get('ContentHandlerUseDB')) {
         $fields[] = 'ar_content_format';
         $fields[] = 'ar_content_model';
     }
     /**
      * Select each archived revision...
      */
     $result = $dbw->select('archive', $fields, $oldWhere, __METHOD__, array('ORDER BY' => 'ar_timestamp'));
     $rev_count = $result->numRows();
     if (!$rev_count) {
         wfDebug(__METHOD__ . ": no revisions to restore\n");
         $status = Status::newGood(0);
         $status->warning("undelete-no-results");
         return $status;
     }
     $result->seek($rev_count - 1);
     // move to last
     $row = $result->fetchObject();
     // get newest archived rev
     $oldPageId = (int) $row->ar_page_id;
     // pass this to ArticleUndelete hook
     $result->seek(0);
     // move back
     // grab the content to check consistency with global state before restoring the page.
     $revision = Revision::newFromArchiveRow($row, array('title' => $article->getTitle()));
     $user = User::newFromName($revision->getUserText(Revision::RAW), false);
     $content = $revision->getContent(Revision::RAW);
     // NOTE: article ID may not be known yet. prepareSave() should not modify the database.
     $status = $content->prepareSave($article, 0, -1, $user);
     if (!$status->isOK()) {
         return $status;
     }
     if ($makepage) {
         // Check the state of the newest to-be version...
         if (!$unsuppress && $row->ar_deleted & Revision::DELETED_TEXT) {
             return Status::newFatal("undeleterevdel");
         }
         // Safe to insert now...
         $newid = $article->insertOn($dbw);
         $pageId = $newid;
     } else {
         // Check if a deleted revision will become the current revision...
         if ($row->ar_timestamp > $previousTimestamp) {
             // Check the state of the newest to-be version...
             if (!$unsuppress && $row->ar_deleted & Revision::DELETED_TEXT) {
                 return Status::newFatal("undeleterevdel");
             }
         }
         $newid = false;
         $pageId = $article->getId();
     }
     $revision = null;
     $restored = 0;
     foreach ($result as $row) {
         // Check for key dupes due to shitty archive integrity.
         if ($row->ar_rev_id) {
             $exists = $dbw->selectField('revision', '1', array('rev_id' => $row->ar_rev_id), __METHOD__);
             if ($exists) {
                 continue;
                 // don't throw DB errors
             }
         }
         // Insert one revision at a time...maintaining deletion status
         // unless we are specifically removing all restrictions...
         $revision = Revision::newFromArchiveRow($row, array('page' => $pageId, 'title' => $this->title, 'deleted' => $unsuppress ? 0 : $row->ar_deleted));
         $revision->insertOn($dbw);
         $restored++;
         Hooks::run('ArticleRevisionUndeleted', array(&$this->title, $revision, $row->ar_page_id));
     }
     # Now that it's safely stored, take it out of the archive
     $dbw->delete('archive', $oldWhere, __METHOD__);
     // Was anything restored at all?
     if ($restored == 0) {
         return Status::newGood(0);
     }
     $created = (bool) $newid;
     // Attach the latest revision to the page...
     $wasnew = $article->updateIfNewerOn($dbw, $revision, $previousRevId);
     if ($created || $wasnew) {
         // Update site stats, link tables, etc
         $user = User::newFromName($revision->getUserText(Revision::RAW), false);
         $article->doEditUpdates($revision, $user, array('created' => $created, 'oldcountable' => $oldcountable));
     }
     Hooks::run('ArticleUndelete', array(&$this->title, $created, $comment, $oldPageId));
     if ($this->title->getNamespace() == NS_FILE) {
         $update = new HTMLCacheUpdate($this->title, 'imagelinks');
         $update->doUpdate();
     }
     return Status::newGood($restored);
 }
开发者ID:agothro,项目名称:mediawiki,代码行数:101,代码来源:SpecialUndelete.php


示例9: recordUpload2

 /**
  * Record a file upload in the upload log and the image table
  */
 function recordUpload2($oldver, $comment, $pageText, $props = false, $timestamp = false)
 {
     global $wgUser;
     $dbw = $this->repo->getMasterDB();
     if (!$props) {
         $props = $this->repo->getFileProps($this->getVirtualUrl());
     }
     $props['description'] = $comment;
     $props['user'] = $wgUser->getID();
     $props['user_text'] = $wgUser->getName();
     $props['timestamp'] = wfTimestamp(TS_MW);
     $this->setProps($props);
     // Delete thumbnails and refresh the metadata cache
     $this->purgeThumbnails();
     $this->saveToCache();
     wfPurgeSquidServers(array($this->getURL()));
     // Fail now if the file isn't there
     if (!$this->fileExists) {
         wfDebug(__METHOD__ . ": File " . $this->getPath() . " went missing!\n");
         return false;
     }
     $reupload = false;
     if ($timestamp === false) {
         $timestamp = $dbw->timestamp();
     }
     # Test to see if the row exists using INSERT IGNORE
     # This avoids race conditions by locking the row until the commit, and also
     # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
     $dbw->insert('image', array('img_name' => $this->getName(), 'img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->media_type, 'img_major_mime' => $this->major_mime, 'img_minor_mime' => $this->minor_mime, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $wgUser->getID(), 'img_user_text' => $wgUser->getName(), 'img_metadata' => $this->metadata, 'img_sha1' => $this->sha1), __METHOD__, 'IGNORE');
     if ($dbw->affectedRows() == 0) {
         $reupload = true;
         # Collision, this is an update of a file
         # Insert previous contents into oldimage
         $dbw->insertSelect('oldimage', 'image', array('oi_name' => 'img_name', 'oi_archive_name' => $dbw->addQuotes($oldver), 'oi_size' => 'img_size', 'oi_width' => 'img_width', 'oi_height' => 'img_height', 'oi_bits' => 'img_bits', 'oi_timestamp' => 'img_timestamp', 'oi_description' => 'img_description', 'oi_user' => 'img_user', 'oi_user_text' => 'img_user_text', 'oi_metadata' => 'img_metadata', 'oi_media_type' => 'img_media_type', 'oi_major_mime' => 'img_major_mime', 'oi_minor_mime' => 'img_minor_mime', 'oi_sha1' => 'img_sha1'), array('img_name' => $this->getName()), __METHOD__);
         # Update the current image row
         $dbw->update('image', array('img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->media_type, 'img_major_mime' => $this->major_mime, 'img_minor_mime' => $this->minor_mime, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $wgUser->getID(), 'img_user_text' => $wgUser->getName(), 'img_metadata' => $this->metadata, 'img_sha1' => $this->sha1), array('img_name' => $this->getName()), __METHOD__);
     } else {
         # This is a new file
         # Update the image count
         $site_stats = $dbw->tableName('site_stats');
         $dbw->query("UPDATE {$site_stats} SET ss_images=ss_images+1", __METHOD__);
     }
     $descTitle = $this->getTitle();
     $article = new Article($descTitle);
     # Add the log entry
     $log = new LogPage('upload');
     $action = $reupload ? 'overwrite' : 'upload';
     $log->addEntry($action, $descTitle, $comment);
     if ($descTitle->exists()) {
         # Create a null revision
         $nullRevision = Revision::newNullRevision($dbw, $descTitle->getArticleId(), $log->getRcComment(), false);
         $nullRevision->insertOn($dbw);
         $article->updateRevisionOn($dbw, $nullRevision);
         # Invalidate the cache for the description page
         $descTitle->invalidateCache();
         $descTitle->purgeSquid();
     } else {
         // New file; create the description page.
         // There's already a log entry, so don't make a second RC entry
         $article->doEdit($pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC);
     }
     # Hooks, hooks, the magic of hooks...
     wfRunHooks('FileUpload', array($this));
     # Commit the transaction now, in case something goes wrong later
     # The most important thing is that files don't get lost, especially archives
     $dbw->immediateCommit();
     # Invalidate cache for all pages using this file
     $update = new HTMLCacheUpdate($this->getTitle(), 'imagelinks');
     $update->doUpdate();
     return true;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:74,代码来源:LocalFile.php


示例10: undeleteRevisions

 /**
  * This is the meaty bit -- restores archived revisions of the given page
  * to the cur/old tables. If the page currently exists, all revisions will
  * be stuffed into old, otherwise the most recent will go into cur.
  *
  * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
  * @param string $comment
  * @param array $fileVersions
  *
  * @return mixed number of revisions restored or false on failure
  */
 private function undeleteRevisions($timestamps)
 {
     if (wfReadOnly()) {
         return false;
     }
     $restoreAll = empty($timestamps);
     $dbw = wfGetDB(DB_MASTER);
     # Does this page already exist? We'll have to update it...
     $article = new Article($this->title);
     $options = 'FOR UPDATE';
     $page = $dbw->selectRow('page', array('page_id', 'page_latest'), array('page_namespace' => $this->title->getNamespace(), 'page_title' => $this->title->getDBkey()), __METHOD__, $options);
     if ($page) {
         # Page already exists. Import the history, and if necessary
         # we'll update the latest revision field in the record.
         $newid = 0;
         $pageId = $page->page_id;
         $previousRevId = $page->page_latest;
     } else {
         # Have to create a new article...
         $newid = $article->insertOn($dbw);
         $pageId = $newid;
         $previousRevId = 0;
     }
     if ($restoreAll) {
         $oldones = '1 = 1';
         # All revisions...
     } else {
         $oldts = implode(',', array_map(array(&$dbw, 'addQuotes'), array_map(array(&$dbw, 'timestamp'), $timestamps)));
         $oldones = "ar_timestamp IN ( {$oldts} )";
     }
     /**
      * Restore each revision...
      */
     $result = $dbw->select('archive', array('ar_rev_id', 'ar_text', 'ar_comment', 'ar_user', 'ar_user_text', 'ar_timestamp', 'ar_minor_edit', 'ar_flags', 'ar_text_id', 'ar_page_id', 'ar_len'), array('ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), $oldones), __METHOD__, array('ORDER BY' => 'ar_timestamp'));
     if ($dbw->numRows($result) < count($timestamps)) {
         wfDebug(__METHOD__ . ": couldn't find all requested rows\n");
         return false;
     }
     $revision = null;
     $restored = 0;
     while ($row = $dbw->fetchObject($result)) {
         if ($row->ar_text_id) {
             // Revision was deleted in 1.5+; text is in
             // the regular text table, use the reference.
             // Specify null here so the so the text is
             // dereferenced for page length info if needed.
             $revText = null;
         } else {
             // Revision was deleted in 1.4 or earlier.
             // Text is squashed into the archive row, and
             // a new text table entry will be created for it.
             $revText = Revision::getRevisionText($row, 'ar_');
         }
         $revision = new Revision(array('page' => $pageId, 'id' => $row->ar_rev_id, 'text' => $revText, 'comment' => $row->ar_comment, 'user' => $row->ar_user, 'user_text' => $row->ar_user_text, 'timestamp' => $row->ar_timestamp, 'minor_edit' => $row->ar_minor_edit, 'text_id' => $row->ar_text_id, 'len' => $row->ar_len));
         $revision->insertOn($dbw);
         $restored++;
         wfRunHooks('ArticleRevisionUndeleted', array(&$this->title, $revision, $row->ar_page_id));
     }
     // Was anything restored at all?
     if ($restored == 0) {
         return 0;
     }
     if ($revision) {
         // Attach the latest revision to the page...
         $wasnew = $article->updateIfNewerOn($dbw, $revision, $previousRevId);
         if ($newid || $wasnew) {
             // Update site stats, link tables, etc
             $article->createUpdates($revision);
         }
         if ($newid) {
             wfRunHooks('ArticleUndelete', array(&$this->title, true));
             Article::onArticleCreate($this->title);
         } else {
             wfRunHooks('ArticleUndelete', array(&$this->title, false));
             Article::onArticleEdit($this->title);
         }
         if ($this->title->getNamespace() == NS_IMAGE) {
             $update = new HTMLCacheUpdate($this->title, 'imagelinks');
             $update->doUpdate();
         }
     } else {
         // Revision couldn't be created. This is very weird
         return self::UNDELETE_UNKNOWNERR;
     }
     # Now that it's safely stored, take it out of the archive
     $dbw->delete('archive', array('ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), $oldones), __METHOD__);
     return $restored;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:99,代码来源:SpecialUndelete.php


示例11: recordDownload

 /**
  * Record a file upload in the upload log and the image table
  */
 private function recordDownload($comment = '', $timestamp = false)
 {
     global $wgUser;
     $dbw = $this->repo->getMasterDB();
     if ($timestamp === false) {
         $timestamp = $dbw->timestamp();
     }
     list($major, $minor) = self::splitMime($this->mime);
     # Test to see if the row exists using INSERT IGNORE
     # This avoids race conditions by locking the row until the commit, and also
     # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
     $dbw->insert('ic_image', array('img_name' => $this->getName(), 'img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->type, 'img_major_mime' => $major, 'img_minor_mime' => $minor, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $wgUser->getID(), 'img_user_text' => $wgUser->getName(), 'img_metadata' => $this->metadata), __METHOD__, 'IGNORE');
     if ($dbw->affectedRows() == 0) {
         # Collision, this is an update of a file
         # Update the current image row
         $dbw->update('ic_image', array('img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->media_type, 'img_major_mime' => $this->major_mime, 'img_minor_mime' => $this->minor_mime, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $wgUser->getID(), 'img_user_text' => $wgUser->getName(), 'img_metadata' => $this->metadata), array('img_name' => $this->getName()), __METHOD__);
     } else {
         # This is a new file
         # Update the image count
         $site_stats = $dbw->tableName('site_stats');
         $dbw->query("UPDATE {$site_stats} SET ss_images=ss_images+1", __METHOD__);
     }
     $descTitle = $this->getTitle();
     $article = new Article($descTitle);
     # Add the log entry
     $log = new LogPage('icdownload');
     $log->addEntry('InstantCommons download', $descTitle, $comment);
     if ($descTitle->exists()) {
         # Create a null revision
         $nullRevision = Revision::newNullRevision($dbw, $descTitle->getArticleId(), $log->getRcComment(), false);
         $nullRevision->insertOn($dbw);
         $article->updateRevisionOn($dbw, $nullRevision);
         # Invalidate the cache for the description page
         $descTitle->invalidateCache();
         $descTitle->purgeSquid();
     }
     # Commit the transaction now, in case something goes wrong later
     # The most important thing is that files don't get lost, especially archives
     $dbw->immediateCommit();
     # Invalidate cache for all pages using this file
     $update = new HTMLCacheUpdate($this->getTitle(), 'imagelinks');
     $update->doUpdate();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:47,代码来源:ICRepo.php


示例12: onArticleDelete

 public static function onArticleDelete($title)
 {
     global $wgMessageCache;
     # Update existence markers on article/talk tabs...
     if ($title->isTalkPage()) {
         $other = $title->getSubjectPage();
     } else {
         $other = $title->getTalkPage();
     }
     $other->invalidateCache();
     $other->purgeSquid();
     $title->touchLinks();
     $title->purgeSquid();
     # File cache
     HTMLFileCache::clearFileCache($title);
     # Messages
     if ($title->getNamespace() == NS_MEDIAWIKI) {
         $wgMessageCache->replace($title->getDBkey(), false);
     }
     # Images
     if ($title->getNamespace() == NS_FILE) {
         $update = new HTMLCacheUpdate($title, 'imagelinks');
         $update->doUpdate();
     }
     # User talk pages
     if ($title->getNamespace() == NS_USER_TALK) {
         $user = User::newFromName($title->getText(), false);
         $user->setNewtalk(false);
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:30,代码来源:Article.php


示例13: propagateMySourceMove

/**
 * Callback function to propagate data
 * @return bool must return true or other hooks don't get called
 */
function propagateMySourceMove(&$title, &$newTitle, &$user, $pageId, $redirPageId)
{
    $ns = $title->getNamespace();
    if ($ns == NS_MYSOURCE) {
        // update people and families that link to this mysource, because source citation has changed
        $u = new HTMLCacheUpdate($title, 'pagelinks');
        $u->doUpdate();
        $u = new HTMLCacheUpdate($newTitle, 'pagelinks');
        $u->doUpdate();
        StructuredData::copyPageLinks($title, $newTitle);
    }
    return true;
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:17,代码来源:MySource.php


示例14: purge

 /**
  * Purges memcache entry and articles having current poll transcluded
  */
 public function purge()
 {
     global $wgMemc;
     wfProfileIn(__METHOD__);
     // clear data cache
     $wgMemc->delete($this->mMemcacheKey);
     $this->mData = null;
     $article = Article::newFromId($this->mPollId);
     if (!empty($article)) {
         // purge poll page
         $article->doPurge();
         // purge articles embedding this poll
         $updateJob = new HTMLCacheUpdate($article->getTitle(), 'templatelinks');
         $updateJob->doUpdate();
         // apply changes to page_touched fields
         $dbw = wfGetDB(DB_MASTER);
         $dbw->commit();
     }
     wfDebug(__METHOD__ . ": purged poll #{$this->mPollId}\n");
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:24,代码来源:WikiaPoll.class.php


示例15: onArticleDelete

 static function onArticleDelete($title)
 {
     global $wgUseFileCache, $wgMessageCache;
     $title->touchLinks();
     $title->purgeSquid();
     # File cache
     if ($wgUseFileCache) {
         $cm = new HTMLFileCache($title);
         @unlink($cm->fileCacheName());
     }
     if ($title->getNamespace() == NS_MEDIAWIKI) {
         $wgMessageCache->replace($title->getDBkey(), false);
     }
     if ($title->getNamespace() == NS_IMAGE) {
         $update = new HTMLCacheUpdate($title, 'imagelinks');
         $update->doUpdate();
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:18,代码来源:Article.php


示例16: touchLinks

 /**
  * Update page_touched timestamps and send squid purge messages for
  * pages linking to this title.	May be sent to the job queue depending 
  * on the number of links. Typically called on create and delete.
  */
 public function touchLinks()
 {
     $u = new HTMLCacheUpdate($this, 'pagelinks');
     $u->doUpdate();
     // Invalidate caches of articles which include this page
     if ($this->getNamespace() != NS_VIDEO) {
         // typically the main namespace video gets purged anyway when it gets updated
         // this could cause a small bug on boundary cases of the page staying in the cache
         $u = new HTMLCacheUpdate($this, 'templatelinks');
         $u->doUpdate();
     }
     if ($this->getNamespace() == NS_CATEGORY) {
         $u = new HTMLCacheUpdate($this, 'categorylinks');
         $u->doUpdate();
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:21,代码来源:Title.php


示例17: doPurge

 /**
  * Override handling of action=purge
  */
 public function doPurge()
 {
     $this->loadFile();
     if ($this->img->exists()) {
         wfDebug("ImagePage::doPurge purging " . $this->img->getName() . "\n");
         $update = new HTMLCacheUpdate($this->mTitle, 'imagelinks');
         $update->doUpdate();
         $this->img->upgradeRow();
         $this->img->purgeCache();
     } else {
         wfDebug("ImagePage::doPurge no image for " . $this->img->getName() . "; limiting purge to cache only\n");
         // even if the file supposedly doesn't exist, force any cached information
         // to be updated (in case the cached information is wrong)
         $this->img->purgeCache();
     }
     parent::doPurge();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:20,代码来源:ImagePage.php


示例18: doPurge

 /**
  * Override handling of action=purge
  * @return bool
  */
 public function doPurge()
 {
     $this->loadFile();
     if ($this->mFile->exists()) {
         wfDebug('ImagePage::doPurge purging ' . $this->mFile->getName() . "\n");
         $update = new HTMLCacheUpdate($this->mTitle, 'imagelinks');
         $update->doUpdate();
         $this->mFile->upgradeRow();
         $this->mFile->purgeCache(array('forThumbRefresh' => true));
     } else {
         wfDebug('ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n");
         // even if the file supposedly doesn't exist, force any cached information
         // to be updated (in case the cached information is wrong)
         $this->mFile->purgeCache(array('forThumbRefresh' => true));
     }
     if ($this->mRepo) {
         // Purge redirect cache
         $this->mRepo->invalidateImageRedirect($this->mTitle);
     }
     return parent::doPurge();
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:25,代码来源:WikiFilePage.php


示例19: setOldImgVisibility

 /**
  * @param $title, the page these events apply to
  * @param array $items list of revision ID numbers
  * @param int $bitfield new rev_deleted value
  * @param string $comment Comment for log records
  */
 function setOldImgVisibility($title, $items, $bitfield, $comment)
 {
     global $wgOut;
     $userAllowedAll = $success = true;
     $count = 0;
     $set = array();
     // Run through and pull all our data in one query
     foreach ($items as $timestamp) {
         $where[] = $timestamp . '!' . $title->getDBKey();
     }
     $result = $this->dbw->select('oldimage', '*', array('oi_name' => $title->getDBKey(), 'oi_archive_name' => $where), __METHOD__);
     while ($row = $this->dbw->fetchObject($result)) {
         $filesObjs[$row->oi_archive_name] = RepoGroup::singleton()->getLocalRepo()->newFileFromRow($row);
         $filesObjs[$row->oi_archive_name]->user = $row->oi_user;
         $filesObjs[$row->oi_archive_name]->user_text = $row->oi_user_text;
     }
     // To work!
     foreach ($items as $timestamp) {
         $archivename = $timestamp . '!' . $title->getDBKey();
         if (!isset($filesObjs[$archivename])) {
             $success = false;
             continue;
             // Must exist
         } else {
             if (!$filesObjs[$archivename]->userCan(File::DELETED_RESTRICTED)) {
                 $userAllowedAll = false;
                 continue;
             }
         }
         $transaction = true;
         // Which revisions did we change anything about?
         if ($filesObjs[$archivename]->deleted != $bitfield) {
             $count++;
             $this->dbw->begin();
             $this->updateOldFiles($filesObjs[$archivename], $bitfield);
             // If this image is currently hidden...
             if ($filesObjs[$archivename]->deleted & File::DELETED_FILE) {
                 if ($bitfield & File::DELETED_FILE) {
                     # Leave it alone if we are not changing this...
                     $set[] = $archivename;
                     $transaction = true;
                 } else {
                     # We are moving this out
                     $transaction = $this->makeOldImagePublic($filesObjs[$archivename]);
                     $set[] = $transaction;
                 }
                 // Is it just now becoming hidden?
             } else {
                 if ($bitfield & File::DELETED_FILE) {
                     $transaction = $this->makeOldImagePrivate($filesObjs[$archivename]);
                     $set[] = $transaction;
                 } else {
                     $set[] = $timestamp;
                 }
             }
             // If our file operations fail, then revert back the db
             if ($transaction == false) {
                 $this->dbw->rollback();
                 return false;
             }
             $this->dbw->commit();
         }
     }
     // Log if something was changed
     if ($count > 0) {
         $this->updateLog($title, $count, $bitfield, $filesObjs[$archivename]->deleted, $comment, $title, 'oldimage', $set);
         # Purge page/history
         $file = wfLocalFile($title);
         $file->purgeCache();
         $file->purgeHistory();
         # Invalidate cache for all pages using this file
         $update = new HTMLCacheUpdate($title, 'imagelinks');
         $update->doUpdate();
     }
     // Where all revs allowed to be set?
     if (!$userAllowedAll) {
         $wgOut->permissionRequired('suppressrevision');
         return false;
     }
     return $success;
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:87,代码来源:SpecialRevisiondelete.php


示例20: undeleteRevisions


//.........这里部分代码省略.........
         $makepage = false;
         # Page already exists. Import the history, and if necessary
         # we'll update the latest revision field in the record.
         $newid = 0;
         $pageId = $page->page_id;
         $previousRevId = $page->page_latest;
         # Get the time span of this page
         $previousTimestamp = $dbw->selectField('revision', 'rev_timestamp', array('rev_id' => $previousRevId), __METHOD__);
         if ($previousTimestamp === false) {
             wfDebug(__METHOD__ . ": existing page refers to a page_latest that does not exist\n");
             return 0;
         }
     } else {
         # Have to create a new article...
         $makepage = true;
         $previousRevId = 0;
         $previousTimestamp = 0;
     }
     if ($restoreAll) {
         $oldones = '1 = 1';
         # All revisions...
     } else {
         $oldts = implode(',', array_map(array(&$dbw, 'addQuotes'), array_map(array(&$dbw, 'timestamp'), $timestamps)));
         $oldones = "ar_timestamp IN ( {$oldts} )";
     }
     /**
      * Select each archived revision...
      */
     $result = $dbw->select('archive', array('ar_rev_id', 'ar_text', 'ar_comment', 'ar_user', 'ar_user_text', 'ar_timestamp', 'ar_minor_edit', 'ar_flags', 'ar_text_id', 'ar_deleted', 'ar_page_id', 'ar_len', 'ar_sha1'), array('ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), $oldones), __METHOD__, array('ORDER BY' => 'ar_timestamp'));
     $ret = $dbw->resultObject($result);
     $rev_count = $dbw->numRows($result);
     if (!$rev_count) {
         wfDebug(__METHOD__ . ": no revisions to restore\n");
         return false;
         // ???
     }
     $ret->seek($rev_count - 1);
     // move to last
     $row = $ret->fetchObject();
     // get newest archived rev
     $ret->seek(0);
     // move back
     if ($makepage) {
         // Check the state of the newest to-be version...
         if (!$unsuppress && $row->ar_deleted & Revision::DELETED_TEXT) {
             return false;
             // we can't leave the current revision like this!
         }
         // Safe to insert now...
      

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP HTMLEditorField类代码示例发布时间:2022-05-23
下一篇:
PHP HTML2PDF_locale类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap