Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltharp committed Jan 18, 2019
1 parent 5c32614 commit c43e8ef
Show file tree
Hide file tree
Showing 2,013 changed files with 252,554 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "lib/zf"]
path = lib/zf
url = git://github.com/tjohns/zf.git
[submodule "lib/spyc"]
path = lib/spyc
url = git://git.utsl.gen.nz/mirror/repo.or.cz/spyc.git
[submodule "lib/h2o"]
path = lib/h2o
url = git://github.com/speedmax/h2o-php.git
[submodule "lib/sfyaml"]
path = lib/sfyaml
url = git://github.com/fabpot/yaml.git
57 changes: 57 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
This file may be outdated.
The up-to-date installation guide is at the following address:

http://www.wikidot.org/installation-guide

This file will be synchronized when we make a release of Wikidot.

To install Wikidot Open Source follow the points:

1. Install PostgreSQL 8.3, PHP 5.2, Lighttpd, ImageMagick and Git.

2. Get Wikidot.

$ git clone git://github.com/gabrys/wikidot.git wikidot
$ cd wikidot
$ git submodule init
$ git submodule update

3. Prepare PostgreSQL database.

NOTE FOR UBUNTU USERS: you need to set user setting in
wikidot/conf/wikidot.ini to your __current__ user, since
Ubuntu enables authorizing local users with PAM by default.

Don't forget to start PostgreSQL:

$ sudo /etc/init.d/postgresql start

or

$ sudo /etc/init.d/postgresql-8.3 start

Now you basically need to run make prepare_db as user postgres.
I usually use the following command:

$ sudo sudo -u postgres make prepare_db

This should ask you for your password. If you don't use sudo just

$ su postgres
Password: (enter postgres password)
$ make prepare_db
$ exit

4. Install Wikidot database and generate configuration files.

$ make

5. Run Wikidot.

$ ./wikidotctl start

To stop use ./wikidotctl stop

6. Go to the URL make prints at the end to configure your wiki superuser password.

> http://127.0.0.1:8080/admin:superadmin/key/...
644 changes: 644 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

all: db keys config finish

prepare_db:
bin/prepare_db.php | psql

db:
bin/bootstrap_db.php files/dump/db/*.sql
bin/generate_om.php
bin/bootstrap_pages.php files/dump/sites/*

keys:
bin/generate_keys.sh

config:
bin/configure.php

finish:
@echo
@echo ============================================
@echo make complete
@echo ============================================
@echo
@echo Run Wikidot server with ./wikidotctl start
@echo and navigate to the following URL to finish:
@echo
@bin/finish_url.php
@echo

debs:
rm -rf build .build
mkdir -p .build/wikidot-`cat VERSION`
cp -r * .build/wikidot-`cat VERSION`
mv .build build
find build/wikidot-`cat VERSION` -type d -name '.git' -print0 | xargs -0 rm -r
cd build/wikidot-`cat VERSION`; rm -r lib/zf/bin lib/zf/demos lib/zf/tests lib/zf/documentation
cd build/wikidot-`cat VERSION`; dpkg-buildpackage -rfakeroot

1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.90
60 changes: 60 additions & 0 deletions bin/bootstrap_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env php
<?php

/**
* Wikidot (Community Edition) - free wiki collaboration software
*
* http://www.wikidot.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Wikidot
* @package Wikidot_Tools
* @version $Id$
* @copyright Copyright (c) 2008, Wikidot Inc. (http://www.wikidot-inc.com)
* @license http://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License
*/

chdir(dirname(__FILE__)); // unifies CLI/CGI cwd handling
require ('../php/setup.php');

// connect to the database
Database::init();

$db = Database::connection();
$db->begin();

$files = $argv;
array_shift($files);

while (count($files)) {
$dump = file_get_contents('../' . $files[0]);
$query_no = 0;

foreach (explode(';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;', $dump) as $query) {
try {
$query_no++;
if (trim($query) != "") {
$db->query($query);
}
} catch (OzoneDatabaseException $e) {
die("\n\nError occured at query number " . $query_no . ', file ' . $files[0] . ":\n" . htmlspecialchars($query) . "\n");
}
}

array_shift($files);
}

$db->commit();

27 changes: 27 additions & 0 deletions bin/bootstrap_pages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php

chdir(dirname(__FILE__));
require ('../php/setup.php');
Ozone::init();

$user = DB_OzoneUserPeer::instance()->selectByPrimaryKey(1);
$page_facade = new Wikidot_Facade_Page($user);

$dirs = $argv;
array_shift($dirs);

foreach ($dirs as $dir) {
foreach (ls('../' . $dir, '*.page') as $file) {
echo "Saving $dir/$file\n";
$source = file('../' . $dir . '/' . $file);
$title = array_shift($source);
$page_facade->save(array(
'site' => basename($dir),
'page' => str_replace('.', ':', preg_replace('/.page$/', '', $file)),
'title' => $title,
'source' => implode('', $source),
));
}
}

20 changes: 20 additions & 0 deletions bin/compile_locale.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Wikidot (Community Edition) - free wiki collaboration software
#
# http://www.wikidot.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

msgfmt locale/pl_PL/LC_MESSAGES/messages.po -o locale/pl_PL/LC_MESSAGES/messages.mo
70 changes: 70 additions & 0 deletions bin/configure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env php
<?php
/**
* Wikidot - free wiki collaboration software
* Copyright (c) 2008, Wikidot Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* For more information about licensing visit:
* http://www.wikidot.org/license
*
* @category Wikidot
* @package Wikidot
* @version $Id$
* @copyright Copyright (c) 2008, Wikidot Inc.
* @license http://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License
*/


/**
* this file creates configuration files that is needed to run Wikidot
*/

$files = array("/files/crontab", "/conf/lighttpd/wikidot_ini.conf", "/conf/secret");

chdir(dirname(__FILE__));
require("../php/setup.php");

chdir(WIKIDOT_ROOT);

$random = random(64);

foreach ($files as $file) {
$src = WIKIDOT_ROOT."$file.orig";
$dst = WIKIDOT_ROOT.$file;
echo "Processing $file .";
$s = file_get_contents($src);
echo ".";
$s = sed($s, $random);
echo ".";
file_put_contents($dst, $s);
echo ".\n";
}

function random($length) {
$r = "";
for ($i = 0; $i < $length; $i++) {
$r .= dechex(rand(0, 15));
}
return $r;
}

function sed($s, $random) {
$s = preg_replace('/%{WIKIDOT:WIKIDOT_ROOT}/', addslashes(WIKIDOT_ROOT), $s);
$s = preg_replace('/%{WIKIDOT:URL_HOST}/', addslashes(GlobalProperties::$URL_HOST), $s);
$s = preg_replace('/%{WIKIDOT:URL_HOST_PREG}/', addslashes(GlobalProperties::$URL_HOST_PREG), $s);
$s = preg_replace('/%{WIKIDOT:URL_DOMAIN}/', addslashes(GlobalProperties::$URL_DOMAIN), $s);
$s = preg_replace('/%{WIKIDOT:URL_DOMAIN_PREG}/', addslashes(GlobalProperties::$URL_DOMAIN_PREG), $s);
$s = preg_replace('/%{WIKIDOT:HTTP_PORT}/', addslashes(GlobalProperties::$HTTP_PORT), $s);
$s = preg_replace('/%{WIKIDOT:RANDOM_STRING}/', $random, $s);
return $s;
}
35 changes: 35 additions & 0 deletions bin/finish_url.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php

/**
* Wikidot (Community Edition) - free wiki collaboration software
*
* http://www.wikidot.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Wikidot
* @package Wikidot_Tools
* @version $Id$
* @copyright Copyright (c) 2008, Wikidot Inc. (http://www.wikidot-inc.com)
* @license http://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License
*/

chdir(dirname(__FILE__)); // unifies CLI/CGI cwd handling
require ('../php/setup.php');

$host = GlobalProperties::$IP_HOST . ':' . GlobalProperties::$HTTP_PORT;
$key = GlobalProperties::$SECRET_MANAGE_SUPERADMIN;

echo "http://$host/admin:superuser/key/$key\n";
5 changes: 5 additions & 0 deletions bin/generate_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

openssl genrsa -out files/key.pem
openssl rsa -in files/key.pem -pubout -out files/public.pem
openssl rsa -in files/key.pem -noout -modulus | sed 's/Modulus=//' > files/modulus.pem
20 changes: 20 additions & 0 deletions bin/generate_mo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Wikidot (Community Edition) - free wiki collaboration software
#
# http://www.wikidot.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

msgfmt locale/pl_PL/LC_MESSAGES/messages.po -o locale/pl_PL/LC_MESSAGES/messages.mo
Loading

0 comments on commit c43e8ef

Please sign in to comment.