jenkins-bot has submitted this change and it was merged. Change subject: Merge branch 'REL1_25' of https://gerrit.wikimedia.org/r/p/mediawiki/extensions/HitCounters into REL1_25 ......................................................................
Merge branch 'REL1_25' of https://gerrit.wikimedia.org/r/p/mediawiki/extensions/HitCounters into REL1_25 Change-Id: I50d7b2c4c8525381b429b386bd4bc3c345d6b984 --- M HitCounters.body.php M ViewCountUpdate.php M drop_field.sql M extension.json M hit_counter_extension.sql M i18n/de.json M i18n/en.json M i18n/gl.json M i18n/it.json M i18n/ko.json M i18n/ksh.json M i18n/mk.json M i18n/pl.json M i18n/qqq.json M i18n/ru.json M i18n/tr.json M initial_count.sql M page_counter.sql M rename_table.sql 19 files changed, 1 insertion(+), 259 deletions(-) Approvals: MarkAHershberger: Looks good to me, approved jenkins-bot: Verified diff --git a/HitCounters.body.php b/HitCounters.body.php index 80ca19d..cba4fc7 100644 --- a/HitCounters.body.php +++ b/HitCounters.body.php @@ -11,7 +11,6 @@ class HitCounters { protected static $mViews; -<<<<<<< HEAD (26b7e2 Icrement extension's version) protected static function cacheStore( $cache, $key, $views ) { if ( $views < 100 ) { // Only cache for a minute @@ -118,92 +117,6 @@ 'INNER JOIN', $wgDBprefix . 'page.page_id = ' . $wgDBprefix . 'hit_counter.page_id' ) -======= - /** - * @return int The view count for the page - */ - public static function getCount( Title $title ) { - if ( $title === null ) { - throw new MWException( "Asked for count without a title!" ); - } - if ( $title->isSpecialPage() ) { - return null; - } - - /* - * Use the cache to avoid hitting the DB if available since - * page views are pretty common and this is a tiny bit of - * information. - */ - $cache = wfGetCache( CACHE_ANYTHING ); - $key = wfMemcKey( 'viewcount', $title->getDBkey() ); - $views = $cache->get( $key ); - if ( !$views ) { - $dbr = wfGetDB( DB_SLAVE ); - $row = $dbr->select( - array( 'hit_counter' ), - array( 'hits' => 'page_counter' ), - array( 'page_id' => $title->getArticleID() ), - __METHOD__ ); - - if ( $row !== false && $current = $row->current() ) { - $views = $current->hits; - /* update only once a day */ - $cache->set( $key, $views, 24 * 3600 ); - } - } - - return $views; - } - - public static function views() { - # Should check for MiserMode here - $cache = wfGetCache( CACHE_ANYTHING ); - $key = wfMemcKey( 'sitestats', 'activeusers-updated' ); - // Re-calculate the count if the last tally is old... - if ( !self::$mViews ) { - self::$mViews = $cache->get( $key ); - wfDebugLog( "HitCounters", __METHOD__ . ": got " . var_export( self::$mViews, true ) . - " from cache." ); - if ( !self::$mViews ) { - $dbr = wfGetDB( DB_SLAVE ); - self::$mViews = $dbr->selectField( 'hit_counter', 'SUM(page_counter)', '', - __METHOD__ ); - wfDebugLog( "HitCounters", __METHOD__ . ": got " . var_export( self::$mViews, true ) . - " from select." ); - $cache->set( $key, self::$mViews, 24 * 3600 ); // don't update for 1 day - } - } - return self::$mViews; - } - - /** - * We can't choose our parameters since this is a hook and we - * don't really need to use the $parser and $cache parameters. - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public static function numberOfViews( Parser &$parser, PPFrame $frame, $args ) { - return self::getCount( $frame->title ); - } - - public static function getQueryInfo() { - global $wgDBprefix; - - return array( - 'tables' => array( 'page', 'hit_counter' ), - 'fields' => array( - 'namespace' => 'page_namespace', - 'title' => 'page_title', - 'value' => 'page_counter' ), - 'conds' => array( - 'page_is_redirect' => 0, - 'page_namespace' => MWNamespace::getContentNamespaces(), - ), - 'join_conds' => array( - 'page' => array( 'INNER JOIN', $wgDBprefix . 'page.page_id = ' . $wgDBprefix . - 'hit_counter.page_id' ) ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) ) ); } diff --git a/ViewCountUpdate.php b/ViewCountUpdate.php index 3e97a9e..5b930eb 100644 --- a/ViewCountUpdate.php +++ b/ViewCountUpdate.php @@ -47,7 +47,6 @@ global $wgHitcounterUpdateFreq; $dbw = wfGetDB( DB_MASTER ); -<<<<<<< HEAD (26b7e2 Icrement extension's version) wfDebugLog ( "HitCounter", "update freq set to: $wgHitcounterUpdateFreq;" ); if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) { $pageId = $this->pageId; @@ -65,22 +64,6 @@ ); } catch ( DBError $e ) { wfDebugLog("HitCounter", "Got an exception: " . $e->getMessage() ); -======= - if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) { - $pageId = $this->pageId; - $method = __METHOD__; - $dbw->onTransactionIdle( function () use ( $dbw, $pageId, $method ) { - try { - $dbw->upsert( 'hit_counter', - // Perform this INSERT if page_id not found - array( 'page_id' => $pageId, 'page_counter' => 1 ), - array( 'page_id' ), - // Perform this SET if page_id found - array( 'page_counter = page_counter + 1' ), - $method - ); - } catch ( DBError $e ) { ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) MWExceptionHandler::logException( $e ); } } ); diff --git a/drop_field.sql b/drop_field.sql index 5cc7c6a..d4159e3 100644 --- a/drop_field.sql +++ b/drop_field.sql @@ -1,8 +1,2 @@ -<<<<<<< HEAD (26b7e2 Icrement extension's version) INSERT INTO /*_*/hit_counter (page_id, page_counter) SELECT /*_*/page.page_id, /*_*/page.page_counter FROM /*_*/page; ALTER TABLE /*_*/page DROP page_counter; -======= -INSERT INTO /*$wgDBprefix*/hit_counter (page_id, page_counter) - SELECT /*$wgDBprefix*/page.page_id, /*$wgDBprefix*/page.page_counter FROM /*$wgDBprefix*/page; -ALTER TABLE /*$wgDBprefix*/page DROP page_counter; ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) diff --git a/extension.json b/extension.json index 466e025..4194547 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,5 @@ { "name": "HitCounters", -<<<<<<< HEAD (26b7e2 Icrement extension's version) "namemsg": "hitcounters-extensionname", "version": "0.2", "author": [ @@ -50,54 +49,6 @@ }, "AutoloadClasses": { "HitCounters\\Hooks": "HitCounters.hooks.php", -======= - "namemsg": "hitcounters-name", - "version": "0.1", - "author": [ - "[//mwstake.org Mark A. Hershberger]" - ], - "url": "https://www.mediawiki.org/wiki/Extension:HitCounters", - "descriptionmsg": "hitcounters-desc", - "type": "variable", - "license-name": "GPL-3.0+", - "MessagesDirs": { - "HitCounters": [ - "i18n" - ] - }, - "ExtensionMessagesFiles": { - "HitCountersMagic": "HitCounters.i18n.magic.php", - "HitCountersAlias": "HitCounters.i18n.alias.php" - }, - "Hooks": { - "SpecialPage_initList": [ - "HitCounters\\Hooks::onSpecialPage_initList" - ], - "SpecialStatsAddExtra": [ - "HitCounters\\Hooks::onSpecialStatsAddExtra" - ], - "LoadExtensionSchemaUpdates": [ - "HitCounters\\Hooks::onLoadExtensionSchemaUpdates" - ], - "MagicWordwgVariableIDs": [ - "HitCounters\\Hooks::onMagicWordwgVariableIDs" - ], - "ParserGetVariableValueSwitch": [ - "HitCounters\\Hooks::onParserGetVariableValueSwitch" - ], - "ParserFirstCallInit": [ - "HitCounters\\Hooks::onParserFirstCallInit" - ], - "PageViewUpdates": [ - "HitCounters\\Hooks::onPageViewUpdates" - ], - "SkinTemplateOutputPageBeforeExec": [ - "HitCounters\\Hooks::onSkinTemplateOutputPageBeforeExec" - ] - }, - "AutoloadClasses": { - "HitCounters\\Hooks": "Hooks.php", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "HitCounters\\HitCounters": "HitCounters.body.php", "ViewCountUpdate": "ViewCountUpdate.php", "HitCounters\\SpecialPopularPages": "SpecialPopularPages.php", diff --git a/hit_counter_extension.sql b/hit_counter_extension.sql index 8df92c0..58813ed 100644 --- a/hit_counter_extension.sql +++ b/hit_counter_extension.sql @@ -1,7 +1,3 @@ -<<<<<<< HEAD (26b7e2 Icrement extension's version) CREATE TABLE /*_*/hit_counter_extension ( -======= -CREATE TABLE /*$wgDBprefix*/hit_counter_extension ( ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) `hc_id` int(10) unsigned NOT NULL ) ENGINE=MEMORY DEFAULT CHARSET=utf8 MAX_ROWS=25000; diff --git a/i18n/de.json b/i18n/de.json index b7bc7dd..f06c37e 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -1,7 +1,6 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "Metalhead64", "Kghbln" ] @@ -14,18 +13,6 @@ "hitcounters-statistics-header-views": "Statistiken ansehen", "hitcounters-statistics-views-total": "Gesamtaufrufe", "hitcounters-statistics-views-total-desc": "Aufrufe nicht vorhandener Seiten sowie von Spezialseiten sind nicht inbegriffen", -======= - "Metalhead64" - ] - }, - "hitcounters-desc": "Bietet Abrufstatistiken pro Seite", - "hitcounters-nviews": "{{PLURAL:$1|Ein Aufruf|$1 Aufrufe}}", - "popularpages": "Beliebte Seiten", - "hitcounters-pageinfo-views": "Anzahl der Aufrufe", - "hitcounters-statistics-header-views": "Statistiken ansehen", - "hitcounters-statistics-views-total": "Gesamtaufrufe", - "hitcounters-statistics-views-total-desc": "Aufrufe von nicht vorhandenen Seiten und Spezialseiten sind nicht inbegriffen", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-statistics-views-peredit": "Aufrufe pro Bearbeitung", "hitcounters-statistics-mostpopular": "Meistbetrachtete Seiten" } diff --git a/i18n/en.json b/i18n/en.json index f2d6b14..35b2569 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -4,11 +4,7 @@ "Mark A. Hershberger" ] }, -<<<<<<< HEAD (26b7e2 Icrement extension's version) "hitcounters-extensionname": "Hit Counter", -======= - "hitcounters-name": "Hit Counter", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-desc": "Provides per page view statistics", "hitcounters-page-label": "[[$1|$1]]", "hitcounters-nviews": "$1 {{PLURAL:$1|view|views}}", diff --git a/i18n/gl.json b/i18n/gl.json index 10eac65..cb8b6ab 100644 --- a/i18n/gl.json +++ b/i18n/gl.json @@ -1,12 +1,8 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "Banjo", "Prevert" -======= - "Banjo" ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) ] }, "hitcounters-desc": "Proporciona estatísticas de visualización por páxina", diff --git a/i18n/it.json b/i18n/it.json index 54e28ef..710204b 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -1,20 +1,12 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "Alexmar983", "Beta16" ] }, "hitcounters-desc": "Fornisce statistiche per ogni vizualizzazione di pagina", "popularpages": "Pagine popolari", -======= - "Alexmar983" - ] - }, - "hitcounters-desc": "Fornisce statistiche per ogni vizualizzazione di pagina", - "popularpages": "Pagine più visitate", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-statistics-header-views": "Vedi statistiche", "hitcounters-statistics-views-total-desc": "Le visite a pagine non esistenti e pagine speciali non sono incluse", "hitcounters-statistics-views-peredit": "Visite per modifica" diff --git a/i18n/ko.json b/i18n/ko.json index c6e5508..ba9fc8f 100644 --- a/i18n/ko.json +++ b/i18n/ko.json @@ -1,16 +1,10 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "Alex00728", "아라" ] }, "popularpages": "인기 있는 문서 목록", -======= - "Alex00728" - ] - }, ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-statistics-header-views": "통계 보기" } diff --git a/i18n/ksh.json b/i18n/ksh.json index 4c85860..d65460b 100644 --- a/i18n/ksh.json +++ b/i18n/ksh.json @@ -4,17 +4,10 @@ "Purodha" ] }, -<<<<<<< HEAD (26b7e2 Icrement extension's version) "hitcounters-extensionname": "Aanzahl Träffer", "hitcounters-desc": "Brängk Schtateßteke pä Sigg.", "hitcounters-nviews": "{{PLURAL:$1|Ene Affrohf|$1 Affrohfe|Kein Affrohfe}}", "popularpages": "Sigge, di öff afjerohfe wähde", -======= - "hitcounters-name": "Aanzahl Träffer", - "hitcounters-desc": "Brängk Schtateßteke pä Sigg.", - "hitcounters-nviews": "{{PLURAL:$1|Ene Affrohf|$1 Affrohfe|Kein Affrohfe}}", - "popularpages": "Jähn affjerohfe Sigge", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-pageinfo-views": "De Aanzahl Affrohfe", "hitcounters-statistics-header-views": "De Schtateßteke belohre", "hitcounters-statistics-views-total": "Alle Affrohfe", diff --git a/i18n/mk.json b/i18n/mk.json index e050971..e3375bd 100644 --- a/i18n/mk.json +++ b/i18n/mk.json @@ -4,17 +4,10 @@ "Bjankuloski06" ] }, -<<<<<<< HEAD (26b7e2 Icrement extension's version) "hitcounters-extensionname": "Бројач на посети", "hitcounters-desc": "Дава статистики за посети на страници", "hitcounters-nviews": "$1 {{PLURAL:$1|посета|посети}}", "popularpages": "Популарни страници", -======= - "hitcounters-name": "Бројач на посети", - "hitcounters-desc": "Дава статистики за посети на страници", - "hitcounters-nviews": "$1 {{PLURAL:$1|посета|посети}}", - "popularpages": "Најпосетувани страници", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-pageinfo-views": "Посети", "hitcounters-statistics-header-views": "Дај статистики", "hitcounters-statistics-views-total": "Вкупно посети", diff --git a/i18n/pl.json b/i18n/pl.json index cf16710..785de0a 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -4,11 +4,7 @@ "Chrumps" ] }, -<<<<<<< HEAD (26b7e2 Icrement extension's version) "popularpages": "Najpopularniejsze strony", -======= - "popularpages": "Popularne strony", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-pageinfo-views": "Liczba wyświetleń", "hitcounters-statistics-header-views": "Zobacz statystyki", "hitcounters-statistics-mostpopular": "Najczęściej odwiedzane strony" diff --git a/i18n/qqq.json b/i18n/qqq.json index 6d5bb6b..3c72ab1 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -1,7 +1,6 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "Mark A. Hershberger", "Liuxinyu970226", "Shirayuki", @@ -14,16 +13,6 @@ "hitcounters-nviews": "This message is used on [[Special:PopularPages]] to say how many times each page has been viewed.\n\nPreceded by the page title, like: Page title ($1 views)\n\nParameters:\n* $1 - the number of views\n{{Identical|View}}", "popularpages": "{{doc-special|PopularPages}}", "popularpages-summary": "{{notranslate}} {{doc-specialpagesummary|popularpages}}", -======= - "Mark A. Hershberger" - ] - }, - "hitcounters-name": "{{optional}}", - "hitcounters-desc": "{{desc|name=HitCounters|url=https://www.mediawiki.org/wiki/Extension:HitCounters}}", - "hitcounters-nviews": "This message is used on [[Special:PopularPages]] to say how many times each page has been viewed.\n\nPreceded by the page title, like: Page title ($1 views)\n\nParameters:\n* $1 - the number of views", - "popularpages": "{{doc-special|PopularPages}}", - "popularpages-summary": "{{doc-specialpagesummary|popularpages}}", ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) "hitcounters-pageinfo-views": "The number of times the page has been viewed.", "hitcounters-statistics-header-views": "Used in [[Special:Statistics]]", "hitcounters-statistics-views-total": "Used in [[Special:Statistics]]", diff --git a/i18n/ru.json b/i18n/ru.json index 0a5a8d9..3b5c4d5 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -1,7 +1,6 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "WindEwriX", "Okras" ] @@ -13,10 +12,4 @@ "hitcounters-statistics-views-total": "Вид просмотров", "hitcounters-statistics-views-total-desc": "Просмотры несуществующих и служебных страниц не учитываются", "hitcounters-statistics-mostpopular": "Наиболее часто просматриваемые страницы" -======= - "WindEwriX" - ] - }, - "popularpages": "Популярные страницы" ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) } diff --git a/i18n/tr.json b/i18n/tr.json index 95ddba6..bdf904c 100644 --- a/i18n/tr.json +++ b/i18n/tr.json @@ -1,12 +1,8 @@ { "@metadata": { "authors": [ -<<<<<<< HEAD (26b7e2 Icrement extension's version) "Watermelon juice", "Emperyan" -======= - "Watermelon juice" ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) ] }, "popularpages": "Popüler sayfalar", diff --git a/initial_count.sql b/initial_count.sql index 27de596..003e0a1 100644 --- a/initial_count.sql +++ b/initial_count.sql @@ -1,7 +1 @@ -<<<<<<< HEAD (26b7e2 Icrement extension's version) INSERT INTO /*_*/hit_counter (page_id, page_counter) SELECT /*_*/page.page_id, /*_*/page.page_counter FROM /*_*/page; -======= - -INSERT INTO /*$wgDBprefix*/hit_counter (page_id, page_counter) - SELECT /*$wgDBprefix*/page.page_id, /*$wgDBprefix*/page.page_counter FROM /*$wgDBprefix*/page; ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) diff --git a/page_counter.sql b/page_counter.sql index 7c70f08..420e59e 100644 --- a/page_counter.sql +++ b/page_counter.sql @@ -1,15 +1,6 @@ -<<<<<<< HEAD (26b7e2 Icrement extension's version) CREATE TABLE /*_*/hit_counter ( page_id INT(8) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, page_counter BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' ) /*$wgDBTableOptions*/; -CREATE INDEX /*i*/page_counter ON /*_*/hit_counter (page_counter); -======= -CREATE TABLE /*$wgDBprefix*/hit_counter ( - page_id INT(8) UNSIGNED NOT NULL, - page_counter BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (page_id), - INDEX (page_counter) -); ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) +CREATE INDEX /*i*/page_counter ON /*_*/hit_counter (page_counter); \ No newline at end of file diff --git a/rename_table.sql b/rename_table.sql index c741bb3..56d8e42 100644 --- a/rename_table.sql +++ b/rename_table.sql @@ -1,6 +1 @@ -<<<<<<< HEAD (26b7e2 Icrement extension's version) RENAME TABLE /*_*/hitcounter TO /*_*/hit_counter_extension; -======= -RENAME TABLE /*$wgDBprefix*/hitcounter TO /*$wgDBprefix*/hit_counter_extension; - ->>>>>>> BRANCH (ce170d Auto-create hit_counter rows for new counts) -- To view, visit https://gerrit.wikimedia.org/r/251725 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I50d7b2c4c8525381b429b386bd4bc3c345d6b984 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/HitCounters Gerrit-Branch: REL1_25 Gerrit-Owner: MarkAHershberger <m...@nichework.com> Gerrit-Reviewer: MarkAHershberger <m...@nichework.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: Springle <sprin...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits