Tool:Wikilint

From Wikitech
Jump to: navigation, search

Description

wikilint (formerly Wikipedia Autoreviewer) is a web based service to find errors (like typos and wrong formating) in Wikipedia articles and make proposals how to improve them. Most features work currently only for the German Wikipedia, but some are also available for English articles.

Usage

wikilint provides a webservice at http://tools.wmflabs.org/wikilint/cgi-bin/wikilint.

Administration

As a prerequisite, the packages libtool, libdbd-sqlite3-perl and sqlite3 need to be installed on tools-login, and the packages libdbd-mysql-perl, libdbd-sqlite3-perl and libdbi-perl on the webservers.

To install or update, use become wikilint to switch to the tool account. Then:

git clone git://github.com/scfc/wikilint.git ~/src/wikilint &&
cd ~/src/wikilint &&
autoreconf &&
./configure --prefix=/data/project/wikilint \
            --with-cgibindir=/data/project/wikilint/cgi-bin \
            --with-htdocsdir=/data/project/wikilint/public_html \
            --with-pmdir=/data/project/wikilint/lib \
            --datarootdir=/data/project/wikilint/share \
            --with-tool_path=http://tools.wmflabs.org/wikilint/cgi-bin/wikilint \
            --with-static_html_path=/wikilint/ &&
make &&
make install &&
cat <<'EOF' > ~/.lighttpd.conf &&
$HTTP["url"] =~ "^/wikilint/cgi-bin" {
    cgi.assign = ( "" => "" )
}
EOF
webservice start

wikilint by default uses SQLite databases with snapshots of information about the German Wikipedia. To activate the use of the live replicated databases, append to ~/.lighttpd.conf:

setenv.add-environment = (
    "WIKILINTUSEDB" => "true"
)

and restart the webservice with webservice restart.

To ease deployment, there is a bare Git repository at ~/var/lib/git/wikilint created by git init --bare ~/var/lib/git/wikilint with the hook post-update:

#!/bin/sh
#
# Copyright 2016, 2017 Tim Landscheidt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# When a commit is pushed to a branch with the name "master" or
# "next", this post-update script will deploy the application to the
# corresponding destination.

# Iterate over all branches that were changed.
for branch in "$@"; do
    # Only process pushes to the branches "master" and "next".
    case "${branch}" in
        refs/heads/master)
            configure_args="--prefix=/data/project/wikilint
            --with-cgibindir=/data/project/wikilint/public_html/cgi-bin
            --with-htdocsdir=/data/project/wikilint/public_html
            --with-pmdir=/data/project/wikilint/lib
            --datarootdir=/data/project/wikilint/share
            --with-tool_path=http://tools.wmflabs.org/wikilint/public_html/cgi-bin/wikilint
            --with-static_html_path=/wikilint/"
            ;;

        refs/heads/next)
            configure_args="--prefix=/data/project/wikilint
            --with-cgibindir=/data/project/wikilint/public_html/cgi-bin/next
            --with-htdocsdir=/data/project/wikilint/public_html/next
            --with-pmdir=/data/project/wikilint/lib-next
            --datarootdir=/data/project/wikilint/share-next
            --with-tool_path=http://tools.wmflabs.org/wikilint/public_html/cgi-bin/next/wikilint
            --with-static_html_path=/wikilint/next/"
            ;;

        *)
            continue
            ;;
    esac

    wcdir="$(mktemp -d)"
    git clone --branch "${branch#refs/heads/}" . "$wcdir"
    (cd "$wcdir" &&
     autoreconf &&
     ./configure $configure_args &&
     make &&
     make install)
    rm -Rf "$wcdir"
done

After adding the repository with:

git remote add toollabs tools-login.wmflabs.org:/data/project/wikilint/var/lib/git/wikilint
git config remote.toollabs.receivepack 'sudo -u tools.wikilint git-receive-pack'
git config remote.toollabs.uploadpack 'sudo -u tools.wikilint git-upload-pack'

pushes to the branches master and next will deploy the application to its production and test destinations, respectively.