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


PHP WikiFactory::resetFlags方法代码示例

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


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

示例1: doUpdateDomains

 /**
  * doUpdateDomains
  *
  * Store changes connected with domains
  *
  * @access private
  * @author eloy@wikia
  *
  * @return mixed	info when change, null when not changed
  */
 private function doUpdateDomains(&$request)
 {
     $action = $request->getText("wpAction", null);
     $reason = $request->getText("wpReason", wfMsg('wikifactory-public-status-change-default-reason'));
     $message = "";
     switch ($action) {
         case "status":
             $status = $request->getVal("wpWikiStatus", 0);
             WikiFactory::setPublicStatus($status, $this->mWiki->city_id, $reason);
             $this->mWiki->city_public = $status;
             WikiFactory::clearCache($this->mWiki->city_id);
             $message = "Status of this wiki was changed to " . $this->mStatuses[$status];
         case "protect":
             $protect = $request->getCheck("wpProtected", false);
             if ($protect) {
                 $message = "Wiki protected";
                 WikiFactory::setFlags($this->mWiki->city_id, WikiFactory::FLAG_PROTECTED, false, $reason);
             } else {
                 $message = "Wiki un-protected";
                 WikiFactory::resetFlags($this->mWiki->city_id, WikiFactory::FLAG_PROTECTED, false, $reason);
             }
             break;
     }
     return Wikia::successmsg($message);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:SpecialWikiFactory_body.php

示例2: onArticleSaveComplete

 /**
  * Hook handler
  *
  * If a sysop makes an edit, unset any flags that have been set so far
  * because the adoption clock starts over again
  * @author Owen Davis
  *
  * @static
  * @param Article $article
  * @param User $user
  * @param $text
  * @param $summary
  * @param $minoredit
  * @param $watchthis
  * @param $sectionanchor
  * @param $flags
  * @param $revision
  * @param $status
  * @param $baseRevId
  * @return bool
  */
 static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
 {
     global $wgCityId;
     if (in_array('sysop', $user->getGroups())) {
         WikiFactory::resetFlags($wgCityId, WikiFactory::FLAG_ADOPTABLE | WikiFactory::FLAG_ADOPT_MAIL_FIRST | WikiFactory::FLAG_ADOPT_MAIL_SECOND, true);
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:29,代码来源:AutomaticWikiAdoptionHelper.class.php

示例3: execute


//.........这里部分代码省略.........
             $newFlags = $newFlags | WikiFactory::FLAG_CREATE_DB_DUMP | WikiFactory::FLAG_HIDE_DB_IMAGES;
         }
         if ($row->city_flags & WikiFactory::FLAG_CREATE_IMAGE_ARCHIVE) {
             if ($dbname && $folder) {
                 $source = $this->tarFiles($folder, $dbname, $cityid);
                 if ($source) {
                     $retval = DumpsOnDemand::putToAmazonS3($source, !$hide, MimeMagic::singleton()->guessMimeType($source));
                     if ($retval > 0) {
                         $this->log("putToAmazonS3 command failed.");
                         echo "Can't copy images to remote host. Please, fix that and rerun";
                         die(1);
                     } else {
                         $this->log("{$source} copied to S3 Amazon");
                         unlink($source);
                         $newFlags = $newFlags | WikiFactory::FLAG_CREATE_IMAGE_ARCHIVE | WikiFactory::FLAG_HIDE_DB_IMAGES;
                     }
                 } else {
                     /**
                      * actually it's better to die than remove
                      * images later without backup
                      */
                     echo "Can't copy images to remote host. Source {$source} is not defined";
                 }
             }
         }
         if ($row->city_flags & WikiFactory::FLAG_DELETE_DB_IMAGES || $row->city_flags & WikiFactory::FLAG_FREE_WIKI_URL) {
             /**
              * clear wikifactory tables, condition for city_public should
              * be always true there but better safe than sorry
              */
             WikiFactory::copyToArchive($row->city_id);
             $dbw = WikiFactory::db(DB_MASTER);
             $dbw->delete("city_list", array("city_public" => array(0, -1), "city_id" => $row->city_id), __METHOD__);
             $this->log("{$row->city_id} removed from WikiFactory tables");
             /**
              * remove records from dataware
              */
             global $wgExternalDatawareDB;
             $datawareDB = wfGetDB(DB_MASTER, array(), $wgExternalDatawareDB);
             $datawareDB->delete("pages", array("page_wikia_id" => $row->city_id), __METHOD__);
             $this->log("{$row->city_id} removed from pages table");
             /**
              * remove images from D.I.R.T.
              */
             $datawareDB->delete("image_review", array("wiki_id" => $row->city_id), __METHOD__);
             $this->log("{$row->city_id} removed from image_review table");
             $datawareDB->delete("image_review_stats", array("wiki_id" => $row->city_id), __METHOD__);
             $this->log("{$row->city_id} removed from image_review_stats table");
             $datawareDB->delete("image_review_wikis", array("wiki_id" => $row->city_id), __METHOD__);
             $this->log("{$row->city_id} removed from image_review_wikis table");
             $datawareDB->commit();
             /**
              * drop database, get db handler for proper cluster
              */
             global $wgDBadminuser, $wgDBadminpassword;
             $centralDB = empty($cluster) ? "wikicities" : "wikicities_{$cluster}";
             /**
              * get connection but actually we only need info about host
              */
             $local = wfGetDB(DB_MASTER, array(), $centralDB);
             $server = $local->getLBInfo('host');
             try {
                 $dbw = new DatabaseMysql($server, $wgDBadminuser, $wgDBadminpassword, $centralDB);
                 $dbw->begin();
                 $dbw->query("DROP DATABASE `{$row->city_dbname}`");
                 $dbw->commit();
                 $this->log("{$row->city_dbname} dropped from cluster {$cluster}");
             } catch (Exception $e) {
                 $this->log("{$row->city_dbname} database drop failed! {$e->getMessage()}");
                 $this->info('drop database', ['cluster' => $cluster, 'dbname' => $row->city_dbname, 'exception' => $e, 'server' => $server]);
             }
             /**
              * update search index
              */
             $indexer = new Wikia\Search\Indexer();
             $indexer->deleteWikiDocs($row->city_id);
             $this->log("Wiki documents removed from index");
             /**
              * there is nothing to set because row in city_list doesn't
              * exists
              */
             $newFlags = false;
         }
         /**
          * reset flags, if database was dropped and data were removed from
          * WikiFactory tables it will return false anyway
          */
         if ($newFlags) {
             WikiFactory::resetFlags($row->city_id, $newFlags);
         }
         $this->info('closed', ['cluster' => $cluster, 'city_id' => (int) $cityid, 'dbname' => $dbname]);
         /**
          * just one?
          */
         if ($first) {
             break;
         }
         sleep($sleep);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:maintenance.php

示例4: execute


//.........这里部分代码省略.........
                             echo "Can't copy images to remote host. Please, fix that and rerun";
                             die(1);
                         }
                     } else {
                         $this->log("{$source} copied to {$target}");
                         unlink($source);
                         $newFlags = $newFlags | WikiFactory::FLAG_CREATE_IMAGE_ARCHIVE | WikiFactory::FLAG_HIDE_DB_IMAGES;
                     }
                 } else {
                     /**
                      * actually it's better to die than remove
                      * images later without backup
                      */
                     echo "Can't copy images to remote host. Source {$source} and target {$target} is not defined";
                     die(1);
                 }
             }
         }
         if ($row->city_flags & WikiFactory::FLAG_DELETE_DB_IMAGES || $row->city_flags & WikiFactory::FLAG_FREE_WIKI_URL) {
             $this->log("removing folder {$folder}");
             if (is_dir($wgUploadDirectory)) {
                 /**
                  * what should we use here?
                  */
                 $cmd = "rm -rf {$folder}";
                 wfShellExec($cmd, $retval);
                 if ($retval) {
                     /**
                      * info removing folder was not possible
                      */
                 }
                 /**
                  * clear wikifactory tables, condition for city_public should
                  * be always true there but better safe than sorry
                  */
                 WikiFactory::copyToArchive($row->city_id);
                 $dbw = WikiFactory::db(DB_MASTER);
                 $dbw->delete("city_list", array("city_public" => array(0, -1), "city_id" => $row->city_id), __METHOD__);
                 $this->log("{$row->city_id} removed from WikiFactory tables");
                 /**
                  * remove records from dataware
                  */
                 global $wgExternalDatawareDB;
                 $datawareDB = wfGetDB(DB_MASTER, array(), $wgExternalDatawareDB);
                 $datawareDB->delete("pages", array("page_wikia_id" => $row->city_id), __METHOD__);
                 $this->log("{$row->city_id} removed from pages table");
                 /**
                  * remove images from D.I.R.T.
                  */
                 $datawareDB->delete("image_review", array("wiki_id" => $row->city_id), __METHOD__);
                 $this->log("{$row->city_id} removed from image_review table");
                 $datawareDB->delete("image_review_stats", array("wiki_id" => $row->city_id), __METHOD__);
                 $this->log("{$row->city_id} removed from image_review_stats table");
                 $datawareDB->delete("image_review_wikis", array("wiki_id" => $row->city_id), __METHOD__);
                 $this->log("{$row->city_id} removed from image_review_wikis table");
                 $datawareDB->commit();
                 /**
                  * drop database, get db handler for proper cluster
                  */
                 global $wgDBadminuser, $wgDBadminpassword;
                 $centralDB = empty($cluster) ? "wikicities" : "wikicities_{$cluster}";
                 /**
                  * get connection but actually we only need info about host
                  */
                 $local = wfGetDB(DB_MASTER, array(), $centralDB);
                 $server = $local->getLBInfo('host');
                 $dbw = new DatabaseMysql($server, $wgDBadminuser, $wgDBadminpassword, $centralDB);
                 $dbw->begin();
                 $dbw->query("DROP DATABASE `{$row->city_dbname}`");
                 $dbw->commit();
                 $this->log("{$row->city_dbname} dropped from cluster {$cluster}");
                 /**
                  * update search index
                  */
                 $cmd = sprintf("curl %s -H \"Content-Type: text/xml\" --data-binary '<delete><query>wid:%d</query></delete>' > /dev/null 2> /dev/null", $wgSolrIndexer, $row->city_id);
                 wfShellExec($cmd, $retval);
                 $this->log("search index removed from {$wgSolrIndexer}");
                 /**
                  * there is nothing to set because row in city_list doesn't
                  * exists
                  */
                 $newFlags = false;
             }
         }
         /**
          * reset flags, if database was dropped and data were removed from
          * WikiFactory tables it will return false anyway
          */
         if ($newFlags) {
             WikiFactory::resetFlags($row->city_id, $newFlags);
         }
         /**
          * just one?
          */
         if ($first) {
             break;
         }
         sleep($sleep);
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:101,代码来源:maintenance.php


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