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


PHP Article::updateArticle方法代码示例

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


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

示例1: notifyRequests

 function notifyRequests($article, $user, $text, $summary, $p5, $p6, $p7)
 {
     global $wgContLang;
     require_once 'Request.php';
     notifyRequester($article, $user, $user, $text, $summary);
     // is the article brandnew
     $t = $article->getTitle();
     if ($t->getNamespace() == NS_MAIN) {
         $dbr = wfGetDB(DB_SLAVE);
         $num_revisions = $dbr->selectField('revision', 'count(*)', array('rev_page=' . $article->getId()));
         if ($num_revisions == 1) {
             // new article
             $r = Title::makeTitle(NS_ARTICLE_REQUEST, $t->getText());
             if ($r->getArticleID() < 0) {
                 $r = Title::makeTitle(NS_ARTICLE_REQUEST, EditPageWrapper::formatTitle($t->getText()));
             }
             if ($r->getArticleID() > 0) {
                 $revision = Revision::newFromTitle($r);
                 $text = $revision->getText();
                 if (strpos($text, wfMsg('answered-requests')) === false) {
                     $ra = new Article($r);
                     $text = ereg_replace("[\\[]+Category\\:([- ]*[.]?[a-zA-Z0-9_/-?&%])*[]]+", "", $text);
                     $text .= "\n[[" . $wgContLang->getNSText(NS_CATEGORY) . ":" . wfMsg('answered-requests') . "]]";
                     $ra->updateArticle($text, wfMsg('request-now-answered'), true, false);
                 }
             }
         }
     }
     return true;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:30,代码来源:RequestTopic.body.php

示例2: upload

 function upload()
 {
     $details = null;
     $this->content = 'error';
     $up = new UploadFromFile();
     $up->initializeFromRequest($this->wg->request);
     $permErrors = $up->verifyPermissions($this->wg->user);
     if ($permErrors !== true) {
         $this->status = self::UPLOAD_PERMISSION_ERROR;
         $this->statusMessage = $this->uploadMessage($this->status, null);
     } else {
         if (empty($this->wg->EnableUploads)) {
             // BugId:6122
             $this->statusMessage = wfMsg('uploaddisabled');
         } else {
             $details = $up->verifyUpload();
             $this->status = is_array($details) ? $details['status'] : UploadBase::UPLOAD_VERIFICATION_ERROR;
             $this->statusMessage = '';
             if ($this->status > 0) {
                 $this->statusMessage = $this->uploadMessage($this->status, $details);
             } else {
                 $titleText = $this->request->getVal('title');
                 $sectionNumber = $this->request->getVal('section', 0);
                 $this->status = $up->performUpload('', '', '', $this->wg->user);
                 $mainArticle = new Article(Title::newFromText($titleText));
                 if ($sectionNumber == 0) {
                     $mainArticle->updateArticle($this->getWikiText($up->getTitle()->getText(), self::LEFT) . $mainArticle->getRawText(), '', false, false);
                 } else {
                     $firstSectionText = $mainArticle->getSection($mainArticle->getRawText(), $sectionNumber);
                     $matches = array();
                     if (preg_match('/={2,3}[^=]+={2,3}/', $firstSectionText, $matches)) {
                         $firstSectionText = trim(str_replace($matches[0], '', $firstSectionText));
                         $newSectionText = $mainArticle->replaceSection($sectionNumber, $matches[0] . "\n" . $this->getWikiText($up->getTitle()->getText(), self::LEFT) . $firstSectionText);
                         $mainArticle->updateArticle($newSectionText, '', false, false);
                     }
                 }
                 $this->content = $this->renderImage($up->getTitle()->getText(), self::LEFT);
             }
         }
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:41,代码来源:ImageDropController.class.php

示例3: execute

 function execute($par)
 {
     global $wgUser, $wgOut, $wgContLang;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
     }
     if ($wgUser->isAnon()) {
         $this->errjump(0);
     }
     $artid = "";
     $spice = "";
     $artname = "";
     $cat = "";
     if (isset($_POST["id"])) {
         $artid = $_POST["id"];
     }
     if (isset($_POST["spice"])) {
         $spice = $_POST["spice"];
     }
     if (isset($_POST["artname"])) {
         $artname = $_POST["artname"];
     }
     if (isset($_POST["cat"])) {
         $cat = $_POST["cat"];
     }
     if (!$spice || !$artname || !$cat) {
         $this->errjump(1);
     }
     # FIXME: mimic CategorySelect here
     $myspice = sha1("Kroko-katMeNot-{$artid}-{$artname}-NotMekat-Schnapp");
     if ($spice != $myspice) {
         $this->errjump(2);
     }
     $title = Title::newFromText($artname);
     if (!is_object($title)) {
         $this->errjump(3);
     }
     $rev = Revision::newFromTitle($title);
     $emptycat = '[[' . $wgContLang->getNsText(NS_CATEGORY) . ':' . wfMsgForContent('fastcat-marker-category') . ']]';
     if ($rev && strstr($rev->getText(), $emptycat)) {
         $newtext = str_replace($emptycat, "[[" . $wgContLang->getNsText(NS_CATEGORY) . ':' . $cat . "]]", $rev->getText());
         if (strcmp($newtext, $rev->getText())) {
             $article = new Article($title);
             $article->updateArticle($newtext, wfMsgForContent('fastcat-edit-comment', $cat), false, false);
             $wgOut->redirect($title->getFullUrl());
         }
     } else {
         $this->errjump(4);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:50,代码来源:SpecialFastCat.body.php

示例4: cleanupArticle

function cleanupArticle($id, $domain)
{
    $title = Title::newFromID($id);
    if (!$title) {
        print "Internal error: no page for ID {$id}\n";
        return;
    }
    print $title->getPrefixedDBkey() . " ...";
    $rev = Revision::newFromTitle($title);
    $reverted = false;
    $revId = $rev->getId();
    $currentRevId = $revId;
    $regex = LinkFilter::makeRegex($domain);
    while ($rev && preg_match($regex, $rev->getText())) {
        # Revision::getPrevious can't be used in this way before MW 1.6 (Revision.php 1.26)
        #$rev = $rev->getPrevious();
        $revId = $title->getPreviousRevisionID($revId);
        if ($revId) {
            $rev = Revision::newFromTitle($title, $revId);
        } else {
            $rev = false;
        }
    }
    if ($revId == $currentRevId) {
        // The regex didn't match the current article text
        // This happens e.g. when a link comes from a template rather than the page itself
        print "False match\n";
    } else {
        $dbw =& wfGetDB(DB_MASTER);
        $dbw->immediateBegin();
        if (!$rev) {
            // Didn't find a non-spammy revision, blank the page
            print "blanking\n";
            $article = new Article($title);
            $article->updateArticle('', wfMsg('spam_blanking', $domain), false, false);
        } else {
            // Revert to this revision
            print "reverting\n";
            $article = new Article($title);
            $article->updateArticle($rev->getText(), wfMsg('spam_reverting', $domain), false, false);
        }
        $dbw->immediateCommit();
        wfDoUpdates();
    }
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:45,代码来源:cleanupSpam.php

示例5: cleanupArticle

/** 
 * Find the latest revision of the article that does not contain spam and revert to it
 */
function cleanupArticle($rev, $regex)
{
    $title = $rev->getTitle();
    $reverted = false;
    $revId = $rev->getId();
    while ($rev && preg_match($regex, $rev->getText())) {
        # Revision::getPrevious can't be used in this way before MW 1.6 (Revision.php 1.26)
        #$rev = $rev->getPrevious();
        $revId = $title->getPreviousRevisionID($revId);
        if ($revId) {
            $rev = Revision::newFromTitle($title, $revId);
        } else {
            $rev = false;
        }
    }
    $dbw =& wfGetDB(DB_MASTER);
    $dbw->immediateBegin();
    if (!$rev) {
        // Didn't find a non-spammy revision, delete the page
        /*
        		print "All revisions are spam, deleting...\n";
        		$article = new Article( $title );
        		$article->doDeleteArticle( "All revisions matched the spam blacklist" );
        */
        // Too scary, blank instead
        print "All revisions are spam, blanking...\n";
        $article = new Article($title);
        $article->updateArticle('', 'All revisions matched the spam blacklist, blanking', false, false);
    } else {
        // Revert to this revision
        $article = new Article($title);
        $article->updateArticle($rev->getText(), "Revert spam", false, false);
    }
    $dbw->immediateCommit();
    wfDoUpdates();
}
开发者ID:BackupTheBerlios,项目名称:spamfilter-svn,代码行数:39,代码来源:cleanupAlt.php

示例6: execute

 function execute($par)
 {
     global $wgRequest, $wgOut, $wgTitle;
     $param = $wgRequest->getText('param');
     $parcheck = $wgRequest->getText('parcheck');
     $action = $wgTitle->getFullURL();
     $description = wfMsgExt('checksite-description', array('parse'));
     $label = wfMsgExt('checksite-label', array('parseinline'));
     $submit = wfMsg('checksite-submit');
     $post = "\n\t\t\t<form action=\"{$action}\" method=\"get\">\n\t\t\t{$description}\n\t\t\t{$label}\n\t\t\t<input type=\"text\" name=\"parcheck\" value=\"{$param}\" size=\"40\" maxlength=\"80\" />\n\t\t\t<input type=\"submit\" value=\"{$submit}\" />\n\t\t\t</form>";
     $this->setHeaders();
     if (!isset($parcheck) || strlen($parcheck) < 5) {
         $wgOut->addHTML($post);
         return;
     }
     $newdom = check_validate_domain($parcheck);
     if (!$newdom) {
         $parcheck = htmlspecialchars($parcheck);
         $wgOut->addWikiMsg('checksite-cant-check', $parcheck);
         return;
     }
     $newpage = $newdom;
     $newpage[0] = strtoupper($newpage[0]);
     $title = Title::newFromUrl($newpage);
     if (!is_object($title)) {
         $wgOut->addWikiMsg('checksite-not-found', $newpage);
         return;
     }
     if (!$title->exists()) {
         $wgOut->addWikiMsg('checksite-not-exist', $newpage);
         return;
     }
     $newhost = check_get_host($newdom);
     if (!$newhost) {
         $wgOut->addWikiMsg('checksite-url-not-found', $newdom);
         return;
     }
     if ($rob = @fopen("http://{$newhost}/robots.txt", 'r')) {
         $txt = fread($rob, 4096);
         while (!feof($rob)) {
             $txt .= fread($rob, 4096);
             if (strlen($txt) > 20000) {
                 break;
             }
         }
         fclose($rob);
         if (eregi("User-agent:[ \t\n]*WebsiteWiki[ \t\r\n]*Disallow:[ \t\r\n]*/", $txt)) {
             global $wgUser;
             $output = wfMsg('checksite-robots', $newhost, $newpage);
             $orgUser = $wgUser;
             //TODO: should this hardcoded user be here?
             $wgUser = User::newFromName('Sysop');
             $article = new Article($title);
             $restrict = array('edit' => 'sysop', 'move' => 'sysop');
             $article->updateRestrictions($restrict, $output);
             $redirectUrl = wfMsg('checksite-redirect-url');
             $redirectComment = wfMsg('checksite-redirect-comment');
             $article->updateArticle("#REDIRECT [[{$redirectUrl}]]", $redirectComment, false, false);
             $wgUser = $orgUser;
             return;
         }
     }
     //TODO: check if this hardcoded URL should remain here
     if (stristr($newhost, 'duckshop.de')) {
         $wgOut->addWikiMsg('checksite-screenshot-error');
         return;
     }
     $output = wfMsg('checksite-screenshot-updating', $newpage);
     /**
      * @todo -- lines below do nothing, so why they are there?
      * 
      * $url = fopen("http://thumbs.websitewiki.de/newthumb.php?name=$newdom", 'r');
      * fclose($url);
      */
     # Output
     $wgOut->addHTML($output);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:77,代码来源:Checksite.body.php

示例7: Article

<?php

require_once "../../classes/article_class.php";
$postdata = file_get_contents("php://input");
$data = json_decode($postdata);
if (!empty($data->title) && !empty($data->category) && !empty($data->content)) {
    $article = new Article($data->alias, $data->title, $data->category, $data->content, $data->url, $data->img_url, $data->meta_title, $data->meta_description, $data->meta_keywords);
    if ($article->articleExists()) {
        $article->updateArticle();
        http_response_code("200");
        echo json_encode(array("message" => "Article with title " . $article->getArticleName() . " as been updated."));
    } else {
        $article->addNewArticle();
        http_response_code("200");
        echo json_encode(array("message" => "Article with title " . $article->getArticleName() . " added to the database"));
    }
} else {
    // redirect to write the article
    http_response_code("400");
    echo json_encode(array("error" => "Title,Content and Category must be filled"));
}
开发者ID:DrNio13,项目名称:love-science,代码行数:21,代码来源:article-submit.php

示例8: reject

 function reject($uid, $reason, $message)
 {
     global $wgUser, $wgOut, $wgLang;
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!in_array('sysop', $wgUser->getGroups())) {
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $wgOut->setArticleBodyOnly(true);
     $dbw = wfGetDB(DB_MASTER);
     //REMOVE PICTURE
     $ret = $this->removePicture($uid);
     if (preg_match('/FAILED/', $ret, $matches)) {
         wfDebug("Avatar removePicture failed: " . $ret . "\n");
     }
     //UPDATE DB RECORD
     $sql = "UPDATE avatar SET av_patrol=-1, av_patrolledBy=" . $wgUser->getID() . ", av_patrolledDate='" . wfTimestampNow() . "', av_rejectReason='" . $dbw->addQuotes($reason) . "' WHERE av_user=" . $dbw->addQuotes($uid);
     $res = $dbw->query($sql, __METHOD__);
     //POST ON TALK PAGE
     $dateStr = $wgLang->timeanddate(wfTimestampNow());
     $user = $wgUser->getName();
     $real_name = User::whoIsReal($wgUser->getID());
     if (!$real_name) {
         $real_name = $user;
     }
     $u = User::newFromID($uid);
     $user_talk = $u->getTalkPage();
     $comment = "";
     $text = "";
     $article = "";
     if ($message) {
         $comment = $message . "\n";
     }
     if ($comment) {
         $formattedComment = wfMsg('postcomment_formatted_comment', $dateStr, $user, $real_name, $comment);
         if ($user_talk->getArticleId() > 0) {
             $r = Revision::newFromTitle($user_talk);
             $text = $r->getText();
         }
         $article = new Article($user_talk);
         $text .= "\n\n{$formattedComment}\n\n";
         $watch = false;
         if ($wgUser->getID() > 0) {
             $watch = $wgUser->isWatched($user_talk);
         }
         if ($user_talk->getArticleId() > 0) {
             $article->updateArticle($text, wfMsg('avatar-rejection-usertalk-editsummary'), true, $watch);
         } else {
             $article->insertNewArticle($text, wfMsg('avatar-rejection-usertalk-editsummary'), true, $watch, false, false, true);
         }
     }
     return "SUCCESS";
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:56,代码来源:Avatar.body.php

示例9: trim

<?php

require_once "../../common.php";
require_once "../classes/class.Article.php";
$log = new System\Login(1);
if (isset($_GET['a'])) {
    $articleID = trim(htmlentities($_GET['a'], ENT_QUOTES, "UTF-8"));
    $articleID = $GLOBALS['DB']->escapeString($articleID);
    $articleData = $GLOBALS['DB']->query("SELECT * FROM article WHERE articleID = '{$articleID}' ", true);
    if ($articleData->num_rows == 1) {
        $article = new Article();
        $article->updateArticle($articleID);
        System\HTML::printHead();
        System\HTML::printHeader();
        ?>

<div role="main" class="main">

  <section class="page-top">
    <div class="container">
      <div class="row">
        <div class="span12">
          <ul class="breadcrumb">
            <li><a href="../../index.php">Startseite</a> <span class="divider">/</span></li>
            <li class="active">Angebot editieren</li>
            </ul>
          </div>
        </div>
        <div class="row">
          <div class="span12">
            <h2>Angebot editieren</h2>
开发者ID:vladvoth,项目名称:crollect,代码行数:31,代码来源:editarticle.php

示例10: wfGetDB

$wgUser->setId(1236204);
$dbr =& wfGetDB(DB_SLAVE);
$res = $dbr->query('select page_title, page_namespace, page_id  from templatelinks, page  where tl_from=page_id and tl_title=\'Fac\';');
while ($row = $dbr->fetchObject($res)) {
    $title = Title::makeTitle($row->page_namespace, $row->page_title);
    $res2 = $dbr->query("select rev_id, rev_timestamp from revision where rev_page={$row->page_id} order by rev_id;");
    while ($row2 = $dbr->fetchObject($res2)) {
        $r = Revision::newFromId($row2->rev_id);
        if (strpos($r->getText(), "{{fac") !== false) {
            $lt = $row2->rev_timestamp;
            $last_id = $row2->rev_id;
            break;
        } else {
        }
    }
    $dbr->freeResult($res2);
    $d = substr($lt, 0, 4) . "-" . substr($lt, 4, 2) . "-" . substr($lt, 6, 2);
    //echo "{$title->getFullURL()} first revision with {{fac}} was {$d}\n";
    $revision = Revision::newFromTitle($title);
    $text = $revision->getText();
    if (strpos($text, "{{fac|date=") === false) {
        $text = str_replace("{{fac}}", "{{fac|date={$d}}}", $text);
        //echo $text;
        $a = new Article(&$title);
        $a->updateArticle($text, "Adding date to {{fac}}", true, false);
        echo "updating {$title->getFullURL()}\n";
    } else {
        echo "NOT UPDATING {$title->getFullURL()}\n";
    }
}
$dbr->freeResult($res);
开发者ID:biribogos,项目名称:wikihow-src,代码行数:31,代码来源:updateFACs.php

示例11: notifyRequester

function notifyRequester($article, $user, $user, $text, $summary)
{
    global $wgTitle, $wgRequest;
    $requested = $wgRequest->getVal('requested', null);
    if ($requested != null && $summary != "Request now answered.") {
        $actualTitleObj = Title::newFromDBKey("Request:" . $wgTitle->getDBKey());
        $actualkey = $wgTitle->getDBKey();
        if ($requested != $actualkey) {
            $ot = Title::newFromDBKey("Request:" . $requested);
            $nt = Title::newFromDBKey("Request:" . $actualkey);
            $error = $ot->moveTo($nt);
            if ($error !== true) {
                echo $error;
            }
            $actualTitleObj = $nt;
        }
        Request::notifyRequest($wgTitle, $actualTitleObj);
        // strip categories
        $at = new Article($actualTitleObj);
        $text = $at->getContent(true);
        //echo $t->getFullText();
        $text = ereg_replace("[\\[]+Category\\:([- ]*[.]?[a-zA-Z0-9_/-?&%])*[]]+", "", $text);
        $text .= "[[Category:Answered Requests]]";
        $at->updateArticle($text, "Request now answered.", true, false);
    }
    return true;
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:27,代码来源:Request.php

示例12: execute


//.........这里部分代码省略.........
            $wgOut->setArticleBodyOnly(true);
            $user = $wgUser->getName();
            $real_name = User::whoIsReal($wgUser->getID());
            if ($real_name == "") {
                $real_name = $user;
            }
            $dateStr = $wgLang->timeanddate(wfTimestampNow());
            $comment = $wgRequest->getVal("details");
            $text = $title->getFullText();
            wfDebug("STA: got text...");
            // filter out links
            $preg = "/[^\\s]*\\.[a-z][a-z][a-z]?[a-z]?/i";
            $matches = array();
            if (preg_match($preg, $comment, $matches) > 0) {
                $wgOut->addHTML(wfMsg('no_urls_in_kudos', $matches[0]));
                return;
            }
            $comment = strip_tags($comment);
            $formattedComment = wfMsg('postcomment_formatted_thanks', $dateStr, $user, $real_name, $comment, $text);
            wfDebug("STA: comment {$formattedComment}\n");
            wfDebug("STA: Checking blocks...");
            $tmp = "";
            if ($wgUser->isBlocked()) {
                $this->blockedIPpage();
                return;
            }
            if (!$wgUser->getID() && $wgWhitelistEdit) {
                $this->userNotLoggedInPage();
                return;
            }
            if ($target == "Spam-Blacklist") {
                $wgOut->readOnlyPage();
                return;
            }
            wfDebug("STA: checking read only\n");
            if (wfReadOnly()) {
                $wgOut->readOnlyPage();
                return;
            }
            wfDebug("STA: checking rate limiter\n");
            if ($wgUser->pingLimiter('userkudos')) {
                $wgOut->rateLimited();
                return;
            }
            wfDebug("STA: checking blacklist\n");
            if ($wgFilterCallback && $wgFilterCallback($title, $comment, "")) {
                // Error messages or other handling should be
                // performed by the filter function
                return;
            }
            wfDebug("STA: checking tokens\n");
            $usertoken = $wgRequest->getVal('token');
            $token1 = $this->getToken1();
            $token2 = $this->getToken2();
            if ($usertoken != $token1 && $usertoken != $token2) {
                wfDebug("STA: User kudos token doesn't match user: {$usertoken} token1: {$token1} token2: {$token2}");
                return;
            }
            wfDebug("STA: going through contributors\n");
            $article = new Article($title);
            //$contributors = $article->getContributors(0, 0, true);
            $contributors = ArticleAuthors::getAuthors($article->getID());
            foreach ($contributors as $k => $v) {
                $u = User::newFromName($k);
                $id = $u->getID();
                //$id = $c->getID();
                //$u = $c;
                wfDebug("STA: going through contributors {$u} {$id}\n");
                if ($id == "0") {
                    continue;
                }
                // forget the anon users.
                //notify via the echo notification system
                if (class_exists('EchoEvent')) {
                    EchoEvent::create(array('type' => 'kudos', 'title' => $title, 'extra' => array('kudoed-user-id' => $id), 'agent' => $wgUser));
                }
                $t = Title::newFromText("User_kudos:" . $u);
                $a = new Article($t);
                $update = $t->getArticleID() > 0;
                $text = "";
                if ($update) {
                    $text = $a->getContent(true);
                    $text .= "\n\n" . $formattedComment;
                    if ($wgFilterCallback && $wgFilterCallback($t, $text, $text)) {
                        // Error messages or other handling should be
                        // performed by the filter function
                        return;
                    }
                }
                if ($update) {
                    $a->updateArticle($text, "", true, false, false, '', false);
                } else {
                    $a->insertNewArticle($text, "", true, false, false, false, false);
                }
            }
            wfDebug("STA: done\n");
            $wgOut->addHTML("Done.");
            $wgOut->redirect('');
        }
    }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:ThankAuthors.body.php

示例13: wfGetDB

<?php

require_once "commandLine.inc";
$wgUser->setID(1236204);
$dbr =& wfGetDB(DB_SLAVE);
$dbw =& wfGetDB(DB_MASTER);
$res = $dbr->select('page', array('page_title', 'page_namespace'), array('page_is_redirect' => 0), "findInlineImages");
$count = 0;
while ($row = $dbr->fetchObject($res)) {
    $title = Title::makeTitle($row->page_namespace, $row->page_title);
    $wgTitle = $title;
    $revision = Revision::newFromTitle($title);
    $text = $revision->getText();
    if (preg_match('/^==[ ]*' . wfMsg('externallinks') . '[ ]*==/im', $text)) {
        $text = preg_replace('/^==[ ]*' . wfMsg('externallinks') . '[ ]*==/im', '== ' . wfMsg('sources') . ' ==', $text);
        $a = new Article($title);
        $a->updateArticle($text, "Changing External Links to Sources and Citations", false, false);
        echo "{$title->getFullURL()} updated\n";
        if ($count % 50 == 0) {
            echo "updating recentchanges to mark it all as patrolled...\n";
            $dbw->query("update recentchanges set rc_patrolled=1 where rc_user=1236204");
        }
        $count++;
        //exit;
    } else {
        //echo "no matches?\n";
    }
}
echo "found {$count} matching\n";
$dbr->freeResult($res);
开发者ID:biribogos,项目名称:wikihow-src,代码行数:30,代码来源:replaceExternalLinksWithSources.php

示例14: substr

        } else {
            $newtext .= substr($text, $j, strlen($text) - $j);
        }
        $text = $newtext;
        if ($now > 0) {
            echo "Adding link to {$t->getText()} pointing to {$x->getText()}\n";
        }
        $replacements += $now;
        #echo "now $now\n";
        $count++;
        #if ($replacements > 1)
        #	break;
        $dbw->query("update recentchanges set rc_patrolled=1 where rc_user_text='LinkTool'");
    }
    if ($replacements > 0) {
        $wgTitle = $t;
        $a = new Article($t);
        if (!$a->updateArticle($text, "LinkTool is sprinkling some links", true, false)) {
            echo "couldn't update article {$t->getText()}, exiting...\n";
            exit;
        }
        echo "updated {$t->getText()}\n";
        $wgTitle = null;
        $updated++;
    }
    if ($updated == 100) {
        echo "updated {$updated} articles, breaking...\n";
        break;
    }
}
echo "checked " . number_format($count) . " articles\n";
开发者ID:biribogos,项目名称:wikihow-src,代码行数:31,代码来源:linkToolExactReplacement.php

示例15: cleanupArticle

 private function cleanupArticle($id, $domain)
 {
     $title = Title::newFromID($id);
     if (!$title) {
         $this->error("Internal error: no page for ID {$id}");
         return;
     }
     $this->output($title->getPrefixedDBkey() . " ...");
     $rev = Revision::newFromTitle($title);
     $revId = $rev->getId();
     $currentRevId = $revId;
     while ($rev && LinkFilter::matchEntry($rev->getText(), $domain)) {
         # Revision::getPrevious can't be used in this way before MW 1.6 (Revision.php 1.26)
         #$rev = $rev->getPrevious();
         $revId = $title->getPreviousRevisionID($revId);
         if ($revId) {
             $rev = Revision::newFromTitle($title, $revId);
         } else {
             $rev = false;
         }
     }
     if ($revId == $currentRevId) {
         // The regex didn't match the current article text
         // This happens e.g. when a link comes from a template rather than the page itself
         $this->output("False match\n");
     } else {
         $dbw = wfGetDB(DB_MASTER);
         $dbw->begin();
         if (!$rev) {
             // Didn't find a non-spammy revision, blank the page
             $this->output("blanking\n");
             $article = new Article($title);
             $article->updateArticle('', wfMsg('spam_blanking', $domain), false, false);
         } else {
             // Revert to this revision
             $this->output("reverting\n");
             $article = new Article($title);
             $article->updateArticle($rev->getText(), wfMsg('spam_reverting', $domain), false, false);
         }
         $dbw->commit();
         wfDoUpdates();
     }
 }
开发者ID:rocLv,项目名称:conference,代码行数:43,代码来源:cleanupSpam.php


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