diff --git a/SpecialWikilog.php b/SpecialWikilog.php index d9873b2..4e118e4 100644 --- a/SpecialWikilog.php +++ b/SpecialWikilog.php @@ -430,7 +430,7 @@ protected function getSelectOptions() $res = $query->select( $dbr, array(), 'p.page_namespace, p.page_title', array(), __FUNCTION__, - array('GROUP BY' => 'wlp_parent', 'ORDER BY' => 'w.page_title') + array('GROUP BY' => [ 'wlp_parent', 'p.page_namespace', 'p.page_title', 'w.page_title' ], 'ORDER BY' => 'w.page_title') ); $values = array(); while( $row = $dbr->fetchRow( $res ) ) diff --git a/Wikilog.php b/Wikilog.php index 7b553e3..f10937b 100644 --- a/Wikilog.php +++ b/Wikilog.php @@ -385,7 +385,7 @@ static function LinkBegin( $skin, $target, $text, $attribs, $query, &$options, & if ( $target->isTalkPage() && ( $i = array_search( 'broken', $options ) ) !== false ) { if ( self::nsHasComments( $target ) ) { - array_splice( $options, $i, 1 ); + array_splice( $options, (int) $i, 1 ); $options[] = 'known'; } } diff --git a/WikilogItem.php b/WikilogItem.php index db496a6..2195c32 100644 --- a/WikilogItem.php +++ b/WikilogItem.php @@ -114,7 +114,7 @@ public function saveData() { $dbw = wfGetDB( DB_MASTER ); $dbw->replace( 'wikilog_posts', - 'wlp_page', + array('wlp_page'), array( 'wlp_page' => $this->mID, 'wlp_parent' => $this->mParent, diff --git a/WikilogItemPager.php b/WikilogItemPager.php index e343432..d7046f3 100644 --- a/WikilogItemPager.php +++ b/WikilogItemPager.php @@ -552,7 +552,7 @@ function formatRow( $row ) { $result = $dbr->select( array( 'wikilog_comments', 'page_last_visit' ), 'COUNT(*)', - array( 'wlc_status' => 'OK', 'IFNULL(wlc_updated>pv_date,1)', 'wlc_post' => $row->wlp_page ), + array( 'wlc_status' => 'OK', 'COALESCE(wlc_updated>pv_date,TRUE)', 'wlc_post' => $row->wlp_page ), __METHOD__, NULL, array( 'page_last_visit' => array( 'LEFT JOIN', array( 'pv_page = wlc_comment_page', 'pv_user' => $wgUser->getID() ) ) ) diff --git a/WikilogMainPage.php b/WikilogMainPage.php index 84ff264..cb1d33d 100644 --- a/WikilogMainPage.php +++ b/WikilogMainPage.php @@ -203,7 +203,7 @@ protected function formatWikilogInformation( $skin ) { $row = $dbr->selectRow( array( 'wikilog_posts', 'page' ), - 'COUNT(*) as total, SUM(wlp_publish) as published', + 'COUNT(*) as total, COUNT(wlp_publish) as published', array( 'wlp_page = page_id', 'wlp_parent' => $this->mTitle->getArticleID(), diff --git a/maintenance/wikilogImportDocumentation.php b/maintenance/wikilogImportDocumentation.php index a3f10a2..307eb5d 100644 --- a/maintenance/wikilogImportDocumentation.php +++ b/maintenance/wikilogImportDocumentation.php @@ -168,7 +168,7 @@ public function handleRevision( $revision ) { $revision->getText(), 0, false, $this->mTimeStamp, $this->mUser); - if ( WikiError::isError( $archive ) || !$archive->isGood() ) { + if ( !$archive->isGood() ) { $this->output( " failed.\n" ); return false; } else { diff --git a/wikilog-tables.pg.sql b/wikilog-tables.pg.sql index fff97ff..47846b6 100644 --- a/wikilog-tables.pg.sql +++ b/wikilog-tables.pg.sql @@ -44,10 +44,10 @@ CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/wikilog_posts ( wlp_parent INT NOT NULL, -- Post title derived from page(page_title), in order to simplify indexing. - wlp_title TEXT NOT NULL, + wlp_title VARCHAR(255) NOT NULL, -- Either if the post was published or not. - wlp_publish BOOLEAN NOT NULL DEFAULT FALSE, + wlp_publish SMALLINT NOT NULL DEFAULT 0 CHECK(wlp_publish = 0 or wlp_publish = 1), -- If wlp_publish = TRUE, this is the date that the post was published, -- otherwise, it is the date of the last draft revision (for sorting). @@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/page_last_visit ( CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/wikilog_subscriptions ( ws_user INT NOT NULL, ws_page INT NOT NULL, - ws_yes BOOLEAN NOT NULL, + ws_yes SMALLINT NOT NULL, ws_date TIMESTAMPTZ NOT NULL, PRIMARY KEY (ws_user, ws_page) ) /*$wgDBTableOptions*/;