Did you know ... Search Documentation:
Title for pldoc(dir_index)

The SWI-Prolog web-site

This repository contains the software of http://www.swi-prolog.org. The (wiki) content of the website and required add-ons are stored in git submodules. These must be installed separately using the command below. To install the site from scratch locally, perform the following commands:

  1. Downloading the site
    % git clone https://github.com/SWI-Prolog/plweb.git
    % cd plweb
    % git submodule update --init
  2. For a full installation, install the dynamic data. The .db files must be writeable by the server process.

    <dl> <dt>annotations.db</dt> <dd>Comments on web pages</dd> <dt>tags.db</dt> <dd>Tags on web pages</dd> <dt>openid.db</dt> <dd>User administration</dd> <dt>packs.db</dt> <dd>Known packages</dd> <dt>post.db</dt> <dd>News posts</dd> <dt>reviews.db</dt> <dd>Pack reviews</dd> <dt>download</dt> <dd>Points to the download directory</dd> </dl>

    Install the download descriptions by running the script install-custom

  3. Create directories for logging and pack mirrors. These directories must be writeable by the server and new directories created below must have the same permissions:
    % mkdir log pack
    % chgrp www-data log pack
    % chmod g+ws log pack

Running the site

After installation, the website may be started locally using the commands below. After that, you have access to the same content as available from https://www.swi-prolog.org, except for the download section of the website. The default port of the site is 3040, and therefore it may be accessed on http://localhost:3040/

% swipl -l load.pl
?- server.

Running as daemon using Ubuntu upstart

A good way to run the website on a Linux server is by creating a Linux container using lxc. After installing the server, you can enable it to start at boot time by copying upstart/swi-prolog.conf to `/etc/init` after editing it to suit your configuration requirements. By default, the server runs as user www-data, group www-data as specified in the above configuration file.

Make sure the following components are writeable to the server process. For files, this means mode 664, group www-data. For directories, this means mode 2775, group www-data.

  • log Write httpd.log and pack-warnings.log
  • pack Mirrors known packages. Will be populated as the server is started.
  • www: subdirectories and .txt files Needs to make the wiki pages editable. It is also wise to do this in a git branch. From the www directory, do:
    % git checkout master
    % git pull
    % git checkout -b wiki
    % find . -type d | xargs chmod 2775
    % find . -name '*.txt' | xargs chmod 664
    % chgrp -W www-data .
  • *.db

Issues with the locally running site

  • There is no download section (but that can't be a big issue)
  • If you want to use the login facility to play with the interactive aspects of the site, you need to
    1. Get a reCAPTCHA key-pair from Google
    2. Run (from a started server)
      ?- set_setting(recaptcha:public_key, 'public key goes here').
      ?- set_setting(recaptcha:private_key, 'private key goes here').
      ?- save_settings.
    3. Run the server from a port that is accessible from the public internet.
    4. Use an OpenID provider that is not too picky for your site. In our experience, Google is less picky than Yahoo.

Prolog files

annotation.pl  -- AnnotationShow source
annotation/3Show annotations for Object.Source
api.plShow source
autocomplete.pl  -- SWI-Prolog website autocompletion supportShow source
blog.plShow source
changelog.plShow source
customise.plShow source
daemon.plShow source
did_you_know.pl  -- Interesting snippets about SWI-PrologShow source
did_you_know/2Generate a DYK fragment.Source
did_you_know_script/3Emit script to fetch DYK through AJAX.Source
download.plShow source
examples.plShow source
ex_xref/3Source
index_examples/0Update the example index.Source
reindex_examples/0Update the example index.Source
fastly.pl  -- Purge pages on our CDNShow source
purge_location/1Send a purge request for a Fastly URL.Source
footer.pl  -- FooterShow source
footer/3Emit the footer, which contains the community content, server address and user information.Source
server_information/2Emit server information.Source
forum.plShow source
generics.pl  -- GenericsShow source
is_empty/1Source
request_to_id/3True when Request is a request to the post service for the given Kind and Id.Source
uri_query_add/4Inserts the given name-value pair as a query component into the given URI.Source
wiki_file_codes_to_dom/3DOM is the HTML dom representation for Codes that originate from File.Source
git_html.plShow source
git_commit_info/5Component to show an individual commit.Source
git_shortlog/4Component that show the top-N most recent changes in Pack.Source
gitweb.pl  -- Provide gitweb supportShow source
holidays.plShow source
todays_holiday/1succeeds if Holiday is 'todays holiday'.Source
http_cgi.pl  -- Run CGI scripts from the SWI-Prolog web-serverShow source
http_cgi_handler/2Locate a CGI script in the file-search-path Alias from the path_info in Request and execute the script using http_run_cgi/3.Source
http_run_cgi/3Execute the given CGI script.Source
load.plShow source
make.plShow source
markdown.pl  -- Parse markdown documents into a DOMShow source
markdown_dom/2Process markdown input into an HTML DOM structure compatible to load_structure/3 and html//1 as provided by library(http/html_write).Source
markitup.pl  -- Wrapper for markItUp ajax markup editorShow source
markitup/3Insert a textarea with markItUp support.Source
messages.pl  -- Run goals that produce messagesShow source
call_showing_messages/2Execute Goal, showing the feedback in the browser.Source
news.pl  -- News on the SWI-Prolog Web siteShow source
random_news/2Emit a random news item for the Did You Know place of the page.Source
notify.pl  -- Send notications by E-mailShow source
msg_user/3Plain-text reference to a user with hyperlink.Source
notify/2Notify watching users by mail of the event on Object, described by Term.Source
object_support.pl  -- Object supportShow source
object_id/2True when Id is a (hash) id for Object.Source
object_label/2True when Label is a label for Object.Source
openid.pl  -- Handle users of the SWI-Prolog websiteShow source
create_user/1Create a new user for the given Google Profile.Source
login_existing_user/1True if the user is know to us and thus we can perform the login without further interaction.Source
authenticate/3Get authentication for editing wiki pages.Source
current_user/2Source
grant/2Grant/revoke User (a UUID) the right to access Token.Source
login_link/3Create a link to login, which returns to the current page.Source
redirect_master/1Redirect a request to the master server, so we do not have to deal with multiple versions of the database files.Source
revoke/2Grant/revoke User (a UUID) the right to access Token.Source
site_user/2Demand the user to be logged on and, if this is the first logon, verify the user and create a profile.Source
site_user_logged_in/1True when User is logged on.Source
user_profile_link/3Create a link to the profile of a user.Source
xrds_specified_location/2Hacks to deal with broken Yadis support.Source
pack.plShow source
current_pack/2True when Pack is a pack that satisfies Filter.Source
hash_file_url/2True when SHA1 was installed using GIT from GitURL.Source
hash_git_url/2True when SHA1 was installed using GIT from GitURL.Source
pack/1True when Pack is a currently known pack.Source
pack_table/4Show a table of packs.Source
pack_url_hash/2True when Hash is the registered hash for URL.Source
pack_version_hashes/2True when HashesByVersion is an ordered list Version-Hashes, latest version first.Source
sort_packs/3Source
pack_analyzer.pl  -- Analyse the content of a Prolog packShow source
pack_analysis/2Result is the analysis result for Pack.Source
pack_members/2Members is a list of file(File,Size) that represent the files in Pack.Source
pack_open_entry/3Open an entry in the Pack for reading.Source
xref_pack/1Run the cross-referencer on all Prolog files inside pack.Source
xref_pack_file/2Run the cross-referencer on File inside Pack.Source
xref_open_source/2If Id refers to a known Prolog pack, open the pack entry.Source
xref_source_file/3Source
xref_source_identifier/2Source
pack_info.pl  -- Visual (web) components that show info about packsShow source
clean_pack_info/1Remove the collected info for Pack.Source
pack_file_details/3Reply with an web-page with details on File in Pack.Source
pack_file_hierarchy/3Create a ul for all files that appear in the pack.Source
pack_readme/3Insert readme information if provided.Source
update_pack_metadata/0Destroy and recompute all pack meta-data.Source
update_pack_metadata_in_background/0Destroy and recompute all pack meta-data.Source
pack_mirror.pl  -- Mirror pack archivesShow source
pack_mirror/3Try to mirror the latest version of Pack into File.Source
pack_mirror_directory/1True when Dir is the absolute file name for the mirrors.Source
pack_unmirror/1Delete all mirrors we have for Pack.Source
ssl_verify/5Currently we accept all certificates.Source
page.plShow source
github_actions/3Emit the github star and sponsor buttons.Source
doc_page_header/4Called to render the PlDoc page header and link menu.Source
body/4Provide the page skin.Source
parms.plShow source
server/2Describe known servers and their role.Source
server/3Describe known servers and their role.Source
plweb.pl  -- Server for PlDoc wiki pages and SWI-Prolog websiteShow source
doc_directory/1Enable editing of wiki documents from the www directory.Source
post.pl  -- PostsShow source
add_post_link/4Emit HTML that allows for adding a new post.Source
all/1News filter, returning all objects.Source
find_posts/3True when Ids is a list of all posts of Kind for which call(CheckId, Id) is true.Source
fresh/1True if post Id is considered fresh.Source
post/3True if Post have Value for the given attribute.Source
post/4Generate HTML for apost.Source
post_process/2HTTP handler that implements a REST interface for postings.Source
posts/6Generate HTML for a list of posts and add a link to add new posts.Source
relevance/2
  • If Importance is higher, then the dropoff of Relevance is flatter.
Source
user_post_count/3True when Count is the number of posts of Kind created by User.Source
user_posts/4Show posts from a specific user of the specified Kind.Source
user_vote_count/3Number of votes issued by this user.Source
proxy.plShow source
proxy/2Proxy a request to a remote server.Source
proxy/3Proxy a request to a remote server.Source
rating.pl  -- Provide a star-rating widgetShow source
register.plShow source
review.pl  -- Handle rating and reviewing of packagesShow source
pack_comment_count/2True when Count is the number of comments for Pack.Source
pack_rating_votes/3Rating is the current rating for Pack, based on Votes.Source
pack_reviews/3Show reviews for Pack.Source
profile_reviews/3Create a h2 section with all reviews by a given OpenID.Source
show_pack_rating/3Show overall rating.Source
show_pack_rating/7Show rating for Pack.Source
user_review_count/2True when Count is the number of reviews by UUID.Source
stats.pl  -- Server statistics componentsShow source
http_server_pool_table/2Display table with statistics on thread-pools.Source
http_server_statistics/2HTML component showing statistics on the HTTP server.Source
http_session_table/2HTML component that writes a table of currently logged on users.Source
tagit.plShow source
ac_object/3Provide additional autocompletion matches on tags,.Source
tagit_footer/4Show tagit widget for adding and deleting tags.Source
user_tags/4Show all tags created by a given user.Source
test_recaptcha.plShow source
tests.plShow source
update.plShow source
db_sync_thread/1Sync the persistency database every Time seconds.Source
watchdog.plShow source
wiki.plShow source
extract_title/3Extract the title from a wiki page.Source
file/4Trap translation of \file(+Path, Options).Source
include/5Source
index_wiki_pages/0Create a (title) index of the available wiki pages.Source
safe_file_name/1True when Name is a file without references to parent directories.Source
title_text/2Turn the title, represented as an argument to html//1 into a plain string.Source
update_wiki_page_title/1Update the cached information about a wiki file.Source
wiki_file_to_dom/2DOM is the HTML dom representation for the content of File.Source
wiki_page_title/2True when Title is the title of the wiki page at Location.Source
wiki_edit.pl  -- Edit PlDoc wiki pagesShow source
edit_button/3Present a button for editing the web-page.Source
location_wiki_file/2Source
location_wiki_file/3Source