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

PHP wfTimestamp函数代码示例

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

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



在下文中一共展示了wfTimestamp函数的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: parserGetVariable

 /**
  * Function check if user is blocked, return true
  * user blocked status is passed to $ret
  * @param $parser Parser
  * @param $varCache ??
  * @param $index ??
  * @param $ret string?
  * @return bool
  */
 public static function parserGetVariable(&$parser, &$varCache, &$index, &$ret)
 {
     if ($index != 'USERBLOCKED') {
         return true;
     }
     $title = $parser->getTitle();
     if ($title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK) {
         $ret = 'unknown';
         return true;
     }
     $user = User::newFromName($title->getBaseText());
     if ($user instanceof User) {
         if (!$user->isBlocked()) {
             $ret = 'false';
             return true;
         }
         // if user is blocked it's pretty much possible they will be unblocked one day :)
         // so we enable cache for shorter time only so that we can recheck later
         // if they weren't already unblocked - if there is a better way to do that, fix me
         $expiry = $user->getBlock()->mExpiry;
         if (is_numeric($expiry)) {
             // sometimes this is 'infinityinfinity'. in that case, use the default cache expiry time.
             $expiry = wfTimestamp(TS_UNIX, $expiry) - wfTimestamp(TS_UNIX);
             if ($expiry > 0) {
                 // just to make sure
                 $parser->getOutput()->updateCacheExpiry($expiry);
             }
         }
         $ret = 'true';
         return true;
     }
     $ret = 'unknown';
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:43,代码来源:InteractiveBlockMessageHooks.php


示例3: addDBData

 function addDBData()
 {
     $user = User::newFromName('UTBlockee');
     if ($user->getID() == 0) {
         $user->addToDatabase();
         $user->setPassword('UTBlockeePassword');
         $user->saveSettings();
     }
     // Delete the last round's block if it's still there
     $oldBlock = Block::newFromTarget('UTBlockee');
     if ($oldBlock) {
         // An old block will prevent our new one from saving.
         $oldBlock->delete();
     }
     $this->block = new Block('UTBlockee', $user->getID(), 0, 'Parce que', 0, false, time() + 100500);
     $this->madeAt = wfTimestamp(TS_MW);
     $this->block->insert();
     // save up ID for use in assertion. Since ID is an autoincrement,
     // its value might change depending on the order the tests are run.
     // ApiBlockTest insert its own blocks!
     $newBlockId = $this->block->getId();
     if ($newBlockId) {
         $this->blockId = $newBlockId;
     } else {
         throw new MWException("Failed to insert block for BlockTest; old leftover block remaining?");
     }
     $this->addXffBlocks();
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:28,代码来源:BlockTest.php


示例4: onArticleViewHeader

 public static function onArticleViewHeader(&$article)
 {
     global $wgOut, $wgLang;
     if ($article->mTitle->getNamespace() == NS_DELETION) {
         $dqi = DeleteQueueItem::newFromDiscussion($article);
         if (!$dqi->isQueued()) {
             break;
         }
         $wgOut->addWikiMsg('deletequeue-deletediscuss-discussionpage', $dqi->getArticle()->mTitle->getPrefixedText(), count($dqi->getEndorsements()), count($dqi->getObjections()));
     }
     $dqi = DeleteQueueItem::newFromArticle($article);
     if (!($queue = $dqi->getQueue())) {
         return true;
     }
     $options = array("deletequeue-page-{$queue}");
     $options[] = $dqi->getReason();
     $expiry = wfTimestamp(TS_UNIX, $dqi->getExpiry());
     $options[] = $wgLang->timeanddate($expiry);
     $options[] = $wgLang->date($expiry);
     $options[] = $wgLang->time($expiry);
     if ($queue == 'deletediscuss') {
         $options[] = $dqi->getDiscussionPage()->mTitle->getPrefixedText();
     }
     call_user_func_array(array($wgOut, 'addWikiMsg'), $options);
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:DeleteQueue.hooks.php


示例5: doLogChangeBatch

 /**
  * @see FileJournal::logChangeBatch()
  * @return Status
  */
 protected function doLogChangeBatch(array $entries, $batchId)
 {
     $status = Status::newGood();
     try {
         $dbw = $this->getMasterDB();
     } catch (DBError $e) {
         $status->fatal('filejournal-fail-dbconnect', $this->backend);
         return $status;
     }
     $now = wfTimestamp(TS_UNIX);
     $data = array();
     foreach ($entries as $entry) {
         $data[] = array('fj_batch_uuid' => $batchId, 'fj_backend' => $this->backend, 'fj_op' => $entry['op'], 'fj_path' => $entry['path'], 'fj_new_sha1' => $entry['newSha1'], 'fj_timestamp' => $dbw->timestamp($now));
     }
     try {
         $dbw->insert('filejournal', $data, __METHOD__);
         if (mt_rand(0, 99) == 0) {
             $this->purgeOldLogs();
             // occasionally delete old logs
         }
     } catch (DBError $e) {
         $status->fatal('filejournal-fail-dbquery', $this->backend);
         return $status;
     }
     return $status;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:30,代码来源:DBFileJournal.php


示例6: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     $strquery = $params['strquery'];
     $result = $this->getResult();
     if (isset($strquery) && $strquery != NULL) {
         $searchString = str_replace('%', '\\%', $strquery);
         $searchString = str_replace('_', '\\_', $searchString);
         $searchString = str_replace('|', '%', $searchString);
         $dbr = $this->getDB();
         $suggestStrings = array();
         $this->addTables('categorylinks');
         $this->addFields('DISTINCT cl_to');
         $this->addWhere(" UPPER(CONVERT(cl_to using latin1)) LIKE UPPER(CONVERT('{$searchString}%' using latin1)) ");
         $res = $this->select(__METHOD__);
         while ($row = $res->fetchObject()) {
             array_push($suggestStrings, $row->cl_to);
             $fit = $result->addValue(array('query', $this->getModuleName()), null, $row->cl_to);
             if (!$fit) {
                 $this->setContinueEnumParameter('start', wfTimestamp(TS_ISO_8601, $row->afl_timestamp));
                 break;
             }
         }
         $dbr->freeResult($res);
     }
     $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'category');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:Categorize.api.php


示例7: getArticleRequestTop

 function getArticleRequestTop()
 {
     global $wgTitle, $wgArticle, $wgRequest, $wgUser;
     $s = "";
     $sk = $wgUser->getSkin();
     $action = $wgRequest->getVal("action");
     if ($wgTitle->getNamespace() == NS_ARTICLE_REQUEST && $action == "" && $wgTitle->getArticleID() > 0) {
         $askedBy = $wgArticle->getUserText();
         $authors = $wgArticle->getContributors(1);
         //$askedBy = "hi" . $authors[0][0];
         //$id = $wgArticle->getUser();
         $real_name = User::whoIsReal($authors[0][0]);
         if ($real_name != "") {
             $askedBy = $real_name;
         } else {
             if ($authors[0][0] == 0) {
                 $askedBy = wfMsg('user_anonymous');
             } else {
                 $askedBy = $authors[0][1];
             }
         }
         $dateAsked = date("F d, Y", wfTimestamp(TS_UNIX, $wgArticle->getTimestamp()));
         $s .= "<div class=\"article_inner\"><table>\n\t\t\t<tr>\n\t\t\t<td width=\"20%\" valign=\"top\">" . wfMsg('request') . "</td><td><b>" . wfMsg('howto', $wgTitle->getText()) . "</b></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td>" . wfMsg('askedby') . "</td><td>" . $askedBy . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td>" . wfMsg('date') . ":</td>\n\t\t\t\t<td>" . $dateAsked . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td valign=\"middle\">" . wfMsg('details') . "</td>\n\t\t\t\t<td><b>\t";
     }
     return $s;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:26,代码来源:Request.php


示例8: sendConfirmAndMigrateMail

 /**
  * Generate a new e-mail confirmation token and send a confirmation/invalidation
  * mail to the user's given address.
  *
  * @return Status object
  */
 public function sendConfirmAndMigrateMail()
 {
     global $wgLang;
     $tokenLife = 14 * 24 * 60 * 60;
     // 14 days
     $expiration = null;
     // gets passed-by-ref and defined in next line.
     $token = $this->confirmationToken($expiration);
     // we want this token to last a little bit longer since we are cold-emailing
     // users and we really want as many responses as possible
     $now = time();
     $expires = $now + $tokenLife;
     $expiration = wfTimestamp(TS_MW, $expires);
     $this->mEmailTokenExpires = $expiration;
     if ($this->isEmailConfirmed()) {
         // Hack to bypass localization of 'Special:'
         // @see User::getTokenUrl
         $mergeAccountUrl = Title::makeTitle(NS_MAIN, 'Special:MergeAccount')->getCanonicalURL();
     } else {
         // create a "token url" for MergeAccount since we have added email
         // confirmation there
         $mergeAccountUrl = $this->getTokenUrl('MergeAccount', $token);
     }
     $invalidateURL = $this->invalidationTokenUrl($token);
     $this->saveSettings();
     return $this->sendMail(wfMessage('centralauth-finishglobaliseemail_subject')->text(), wfMessage("centralauth-finishglobaliseemail_body", $this->getRequest()->getIP(), $this->getName(), $mergeAccountUrl, $wgLang->timeanddate($expiration, false), $invalidateURL, $wgLang->date($expiration, false), $wgLang->time($expiration, false))->text());
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:33,代码来源:EmailableUser.php


示例9: getCoordinator

 private function getCoordinator()
 {
     $clientWikis = array('dewiki' => 'dewikidb', 'enwiki' => 'enwikidb', 'nlwiki' => 'nlwikidb', 'ruwiki' => 'ruwikidb', 'zhwiki' => 'zhwikidb');
     $coordinator = new SqlChangeDispatchCoordinator(false, $clientWikis);
     $coordinator->setBatchSize(3);
     $coordinator->setRandomness(3);
     $coordinator->setLockGraceInterval(120);
     $coordinator->setDispatchInterval(60);
     $coordinator->setArrayRandOverride(function ($array) {
         $keys = array_keys($array);
         $last = end($keys);
         return $last;
     });
     $coordinator->setTimeOverride(function () {
         return wfTimestamp(TS_UNIX, '20140303000000');
     });
     $coordinator->setIsClientLockUsedOverride(function ($wikiDB, $lockName) {
         return $wikiDB === 'zhwikidb';
     });
     $coordinator->setEngageClientLockOverride(function ($wikiDB) {
         return $wikiDB !== 'zhwikidb';
     });
     $coordinator->setReleaseClientLockOverride(function ($wikiDB) {
         return true;
     });
     return $coordinator;
 }
开发者ID:TU-Berlin,项目名称:WikidataMath,代码行数:27,代码来源:SqlChangeDispatchCoordinatorTest.php


示例10: execute

 public function execute()
 {
     global $wgDBname;
     if ($this->hasOption('days')) {
         $inactivitydays = $this->getOption('days');
     } else {
         $inactivitydays = 30;
     }
     if ($this->hasOption('timezone')) {
         $timezone = $this->getOption('timezone');
     } else {
         $timezone = 'UTC';
     }
     # Generates a timestamp in yearmonthdayhourminutesecond format of the current time
     date_default_timezone_set($timezone);
     $date = date("YmdHis", strtotime("-{$inactivitydays} days"));
     $dbw = wfGetDB(DB_MASTER);
     $res = $dbw->select('recentchanges', 'rc_timestamp', 'rc_timestamp >= ' . $dbw->addQuotes($date), __METHOD__, array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => 1));
     if ($res->numRows() > 0) {
         if ($this->hasOption('display-active')) {
             foreach ($res as $row) {
                 $this->output("The wiki \"{$wgDBname}\" does NOT meet the inactivity requirements, date of last RecentChanges log entry: " . wfTimestamp(TS_DB, $row->rc_timestamp) . "\n");
             }
         }
     } else {
         $res = $dbw->select('recentchanges', 'rc_timestamp', 'rc_timestamp < ' . $dbw->addQuotes($date), __METHOD__, array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => 1));
         foreach ($res as $row) {
             $this->output("The wiki \"{$wgDBname}\" DOES meet the inactivity requirements, date of last RecentChanges log entry: " . wfTimeStamp(TS_DB, $row->rc_timestamp) . "\n");
         }
     }
 }
开发者ID:addshore,项目名称:OrainMaintenance,代码行数:31,代码来源:checkWikiActivity.php


示例11: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     $result = $this->getResult();
     $userName = $params['user'];
     $daysago = $params['daysago'];
     $basetimestamp = $params['basetimestamp'];
     $user = User::newFromName($userName);
     if (!$user) {
         $this->dieUsage('Invalid username', 'bad_user');
     }
     global $wgAuth, $wgUserDailyContributionsApiCheckAuthPlugin;
     if ($wgUserDailyContributionsApiCheckAuthPlugin && !$wgAuth->userExists($userName)) {
         $this->dieUsage('Specified user does not exist', 'bad_user');
     }
     // Defaults to 'now' if not given
     $totime = wfTimestamp(TS_UNIX, $basetimestamp);
     $fromtime = $totime - $daysago * 60 * 60 * 24;
     $result->addValue($this->getModuleName(), 'id', $user->getId());
     // Returns date of registration in YYYYMMDDHHMMSS format
     $result->addValue($this->getModuleName(), 'registration', $user->getRegistration() ? $user->getRegistration() : '0');
     // Returns number of edits between daysago date and basetimestamp (or today)
     $result->addValue($this->getModuleName(), 'timeFrameEdits', getUserEditCountSince($fromtime, $user, $totime));
     // Returns total number of edits
     $result->addValue($this->getModuleName(), 'totalEdits', $user->getEditCount() == NULL ? 0 : $user->getEditCount());
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:26,代码来源:ApiUserDailyContribs.php


示例12: displayRecentChanges

 static function displayRecentChanges()
 {
     $html = '';
     $html .= '<table width="100%">';
     $changes = CustomTitleChangesLog::dbGetRecentChanges(10);
     $html .= "<tr><th>When</th><th>User</th><th>Summary</th></tr>\n";
     $users = array();
     foreach ($changes as $change) {
         $html .= '<tr>';
         $ts = wfTimestamp(TS_UNIX, $change['tcc_timestamp']);
         $html .= "<td>" . date('Y-m-d', $ts) . "</td>";
         $userid = $change['tcc_userid'];
         if (!isset($users[$userid])) {
             $users[$userid] = User::newFromId($userid);
         }
         $user = $users[$userid];
         $usertext = $user ? $user->getName() : '';
         $html .= "<td>{$usertext}</td>";
         $summary = substr($change['tcc_summary'], 0, 200);
         if ($summary != $change['tcc_summary']) {
             $summary .= '...';
         }
         $html .= "<td>{$summary}</td>";
         $html .= "</tr>\n";
     }
     $html .= '</table>';
     return $html;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:28,代码来源:AdminTitles.body.php


示例13: execute

 public function execute()
 {
     global $wgContLang;
     $pageSet = $this->getPageSet();
     $pageids = array_keys($pageSet->getGoodTitles());
     if (!$pageids) {
         return true;
     }
     // Construct SQL Query
     $this->addTables('flaggedpages');
     $this->addFields(array('fp_page_id', 'fp_stable', 'fp_quality', 'fp_pending_since'));
     $this->addWhereFld('fp_page_id', $pageids);
     $res = $this->select(__METHOD__);
     $result = $this->getResult();
     foreach ($res as $row) {
         $data = array('stable_revid' => intval($row->fp_stable), 'level' => intval($row->fp_quality), 'level_text' => FlaggedRevs::getQualityLevelText($row->fp_quality));
         if ($row->fp_pending_since) {
             $data['pending_since'] = wfTimestamp(TS_ISO_8601, $row->fp_pending_since);
         }
         $result->addValue(array('query', 'pages', $row->fp_page_id), 'flagged', $data);
     }
     $this->resetQueryParams();
     $this->addTables('flaggedpage_config');
     $this->addFields(array('fpc_page_id', 'fpc_level', 'fpc_expiry'));
     $this->addWhereFld('fpc_page_id', $pageids);
     foreach ($this->select(__METHOD__) as $row) {
         $result->addValue(array('query', 'pages', $row->fpc_page_id, 'flagged'), 'protection_level', $row->fpc_level);
         $result->addValue(array('query', 'pages', $row->fpc_page_id, 'flagged'), 'protection_expiry', $wgContLang->formatExpiry($row->fpc_expiry, TS_ISO_8601));
     }
     return true;
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:31,代码来源:ApiQueryFlagged.php


示例14: execute

 public function execute()
 {
     global $wgUser;
     $result = $this->getResult();
     $params = $this->extractRequestParams();
     $token = array();
     if ($wgUser->isAnon()) {
         if (!isset($params['anontoken'])) {
             $this->dieUsageMsg(array('missingparam', 'anontoken'));
         } elseif (strlen($params['anontoken']) != 32) {
             $this->dieUsage('The anontoken is not 32 characters', 'invalidtoken');
         }
         $token = $params['anontoken'];
     } else {
         $token = '';
     }
     $dbr = wfGetDB(DB_SLAVE);
     $dbw = wfGetDB(DB_MASTER);
     // Check if the incoming survey is valid
     $surveyCount = $dbr->selectRow('research_tools_surveys', 'rts_id', array('rts_id' => $params['survey']), __METHOD__);
     if ($surveyCount === false) {
         $this->dieUsage('The survey is unknown', 'invalidsurvey');
     }
     // Find an existing response from this user for this survey
     $response = $dbr->selectRow('research_tools_survey_responses', 'rtsr_id', array('rtsr_user_text' => $wgUser->getName(), 'rtsr_user_anon_token' => $token, 'rtsr_survey' => $params['survey']), __METHOD__);
     if ($response !== false) {
         // Delete any of the previous answers (they questions may have changed)
         $dbw->delete('research_tools_survey_answers', array('rtsa_response' => $response->rtsr_id), __METHOD__);
     }
     // Decode JSON answer data
     $answers = FormatJson::decode($params['answers'], true);
     if (!is_array($answers)) {
         $this->dieUsage('Invalid answer data', 'invalidanswers');
     }
     // Verify questions exist
     foreach ($answers as $question => $answer) {
         $question = $dbr->selectRow('research_tools_survey_questions', 'rtsq_id', array('rtsq_survey' => $params['survey'], 'rtsq_id' => $question), __METHOD__);
         if ($question === false) {
             $this->dieUsage('A question is unknown', 'invalidquestion');
         }
     }
     if ($response === false) {
         // Insert a new response row
         $dbw->insert('research_tools_survey_responses', array('rtsr_time' => wfTimestamp(TS_MW), 'rtsr_user_text' => $wgUser->getName(), 'rtsr_user_anon_token' => $token, 'rtsr_survey' => $params['survey']), __METHOD__);
         $response = $dbw->insertId();
     } else {
         $response = $response->rtsr_id;
         // Update the timestamp of the existing response row
         $dbw->update('research_tools_survey_responses', array('rtsr_time' => wfTimestamp(TS_MW)), array('rtsr_id' => $response), __METHOD__);
     }
     // Insert answers for the response
     $answerRows = array();
     foreach ($answers as $question => $answer) {
         // Build row data
         $answerRows[] = array('rtsa_response' => $response, 'rtsa_question' => $question, 'rtsa_value_integer' => is_numeric($answer) ? intval($answer) : null, 'rtsa_value_text' => is_numeric($answer) ? '' : $answer);
     }
     $dbw->insert('research_tools_survey_answers', $answerRows, __METHOD__);
     // Add success to result
     $result->addValue(null, $this->getModuleName(), array('result' => 'Success'));
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:60,代码来源:ApiResearchToolsSurveyResponse.php


示例15: listFilesFlat

 private static function listFilesFlat($base_path)
 {
     #static $count=0;
     $results = array();
     foreach (new DirectoryIterator($base_path) as $fileinfo) {
         #$count++;if ($count>1000) break;
         if ($fileinfo->isDot()) {
             continue;
         } elseif ($fileinfo->isDir()) {
             $new_results = self::listFilesFlat($fileinfo->getPathname());
             $results = array_merge($results, $new_results);
         } else {
             $path = $fileinfo->getPathname();
             // a hack for filenames that have / in them
             $fn = preg_replace('@^/var/www/images_en/./../@', '', $path);
             $hash = md5($fn);
             if (isset($results[$hash])) {
                 print "error: dup hash for {$fn}\n";
             } else {
                 $results[$hash] = array('path' => $path, 'file' => $fn, 'size' => $fileinfo->getSize(), 'time' => wfTimestamp(TS_MW, $fileinfo->getMTime()));
             }
         }
     }
     return $results;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:25,代码来源:checkAllImages.php


示例16: execute

 public function execute()
 {
     global $wgUser;
     $params = $this->extractRequestParams();
     if (!$wgUser->isAllowed('checkuser-log')) {
         $this->dieUsage('You need the checkuser-log right', 'permissionerror');
     }
     list($user, $limit, $target, $from, $to) = array($params['user'], $params['limit'], $params['target'], $params['from'], $params['to']);
     $this->addTables('cu_log');
     $this->addOption('LIMIT', $limit + 1);
     $this->addWhereRange('cul_timestamp', 'older', $from, $to);
     $this->addFields(array('cul_timestamp', 'cul_user_text', 'cul_reason', 'cul_type', 'cul_target_text'));
     if (isset($user)) {
         $this->addWhereFld('cul_user_text', $user);
     }
     if (isset($target)) {
         $this->addWhereFld('cul_target_text', $target);
     }
     $res = $this->select(__METHOD__);
     $result = $this->getResult();
     $log = array();
     foreach ($res as $row) {
         $log[] = array('timestamp' => wfTimestamp(TS_ISO_8601, $row->cul_timestamp), 'checkuser' => $row->cul_user_text, 'type' => $row->cul_type, 'reason' => $row->cul_reason, 'target' => $row->cul_target_text);
     }
     $result->addValue(array('query', $this->getModuleName()), 'entries', $log);
     $result->setIndexedTagName_internal(array('query', $this->getModuleName(), 'entries'), 'entry');
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:ApiQueryCheckUserLog.php


示例17: getFeedItems

 function getFeedItems($user)
 {
     global $wgMemc;
     $fname = "Feed::getFeedItems";
     wfProfileIn($fname);
     $key = "feed_user_" . $user->getID();
     $feed = $wgMemc->get($key);
     if (!$feed || true) {
         $feed = array();
     }
     // was this feed updated in the last 30 minutes?
     $old = wfTimestamp(TS_MW, time() - 1800);
     if (isset($feed['updated']) && $feed['updated'] > $old) {
         return $feed;
     }
     // get what they are interested in
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('follow', array('*'), array('fo_user' => $user->getID()), $fname, array("ORDER BY" => "fo_weight desc"));
     $follows = array();
     while ($row = $dbr->fetchObject($res)) {
         $feed[] = $row;
     }
     $wgMemc->set($key, $feed, 600);
     // store it for 2 days
     wfProfileOut($fname);
     return $feed;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:27,代码来源:Feed.body.php


示例18: merge

 public static function merge(BloomCache $bcache, $domain, $virtualKey, array $status)
 {
     $limit = 1000;
     $dbr = wfGetDB(DB_SLAVE, array(), $domain);
     $res = $dbr->select('logging', array('log_namespace', 'log_title', 'log_id', 'log_timestamp'), array('log_id > ' . $dbr->addQuotes((int) $status['lastID'])), __METHOD__, array('ORDER BY' => 'log_id', 'LIMIT' => $limit));
     $updates = array();
     if ($res->numRows() > 0) {
         $members = array();
         foreach ($res as $row) {
             $members[] = "{$virtualKey}:{$row->log_namespace}:{$row->log_title}";
         }
         $lastID = $row->log_id;
         $lastTime = $row->log_timestamp;
         if (!$bcache->add('shared', $members)) {
             return false;
         }
         $updates['lastID'] = $lastID;
         $updates['asOfTime'] = wfTimestamp(TS_UNIX, $lastTime);
     } else {
         $updates['asOfTime'] = microtime(true);
     }
     $updates['epoch'] = $status['epoch'] ?: microtime(true);
     $bcache->setStatus($virtualKey, $updates);
     return $updates;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:25,代码来源:BloomFilters.php


示例19: alterHeaders

 /**
  * alterHeaders
  *
  * Put the Memento headers in place for this directly accessed Memento.
  */
 public function alterHeaders()
 {
     global $wgMementoIncludeNamespaces;
     $out = $this->article->getContext()->getOutput();
     $request = $out->getRequest();
     $response = $request->response();
     $titleObj = $this->article->getTitle();
     $linkEntries = array();
     // if we exclude this Namespace, don't show folks Memento relations
     if (!in_array($titleObj->getNamespace(), $wgMementoIncludeNamespaces)) {
         $entry = '<http://mementoweb.org/terms/donotnegotiate>; rel="type"';
         $linkEntries[] = $entry;
     } else {
         $title = $this->getFullNamespacePageTitle($titleObj);
         $mementoTimestamp = $this->article->getRevisionFetched()->getTimestamp();
         // convert for display
         $mementoDatetime = wfTimestamp(TS_RFC2822, $mementoTimestamp);
         $uri = $titleObj->getFullURL();
         $tguri = $this->getTimeGateURI($title);
         $entry = $this->constructLinkRelationHeader($uri, 'original latest-version');
         $linkEntries[] = $entry;
         $entry = $this->constructLinkRelationHeader($tguri, 'timegate');
         $linkEntries[] = $entry;
         $first = $this->getFirstMemento($titleObj);
         $last = $this->getLastMemento($titleObj);
         // TODO: Throw a 400-status error message if
         // getFirstMemento/getLastMemento is null?
         // how would we have gotten here if titleObj was bad?
         $entries = $this->generateRecommendedLinkHeaderRelations($titleObj, $first, $last);
         $linkEntries = array_merge($linkEntries, $entries);
         $response->header("Memento-Datetime:  {$mementoDatetime}", true);
     }
     $linkEntries = implode(',', $linkEntries);
     $response->header("Link: {$linkEntries}", true);
 }
开发者ID:NDKilla,项目名称:memento,代码行数:40,代码来源:MementoResourceDirectlyAccessed.php


示例20: getCoordinator

 private function getCoordinator()
 {
     $coordinator = new SqlChangeDispatchCoordinator(false, 'TestRepo');
     $coordinator->setBatchSize(3);
     $coordinator->setRandomness(3);
     $coordinator->setLockGraceInterval(120);
     $coordinator->setDispatchInterval(60);
     $coordinator->setArrayRandOverride(function ($array) {
         $keys = array_keys($array);
         $last = end($keys);
         return $last;
     });
     $coordinator->setTimeOverride(function () {
         return wfTimestamp(TS_UNIX, '20140303000000');
     });
     $coordinator->setIsClientLockUsedOverride(function ($db, $lockName) {
         return $lockName === 'Wikibase.TestRepo.dispatchChanges.zhwiki';
     });
     $coordinator->setEngageClientLockOverride(function ($db, $lockName) {
         return $lockName !== 'Wikibase.TestRepo.dispatchChanges.zhwiki';
     });
     $coordinator->setReleaseClientLockOverride(function ($db, $lockName) {
         return true;
     });
     return $coordinator;
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:26,代码来源:SqlChangeDispatchCoordinatorTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wfTimestampNow函数代码示例发布时间:2022-05-23
下一篇:
PHP wfTime函数代码示例发布时间: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