move to multisite-model
40
rebuild.php
@ -3,16 +3,6 @@
|
||||
// Code-hosting website
|
||||
// ````````````````````
|
||||
|
||||
// CONFIGURATION
|
||||
// `````````````
|
||||
|
||||
define('BASEDIR', __DIR__.'\\');
|
||||
define('SITE_TITLE', 'code.ivysaur.me');
|
||||
define('PAGE_THUMB_W', 60);
|
||||
define('PAGE_THUMB_H', 60);
|
||||
define('INDEX_THUMB_W', 90);
|
||||
define('INDEX_THUMB_H', 32); // recommend a multiple of the jpg iDCT block size
|
||||
|
||||
/**
|
||||
* Create a thumbnail of an image. It overscales, centers, and crops to fit the
|
||||
* target dimensions.
|
||||
@ -263,7 +253,7 @@ class CProject {
|
||||
|
||||
<p><?=text2html($this->longdesc)?></p>
|
||||
|
||||
<?=file_get_contents(__DIR__.'/footer.htm')?>
|
||||
<?=file_get_contents(BASEDIR.'/footer.htm')?>
|
||||
|
||||
<?php if (count($this->downloads)) { ?>
|
||||
|
||||
@ -317,7 +307,7 @@ function template($title, $content) {
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="content">
|
||||
<?=file_get_contents(__DIR__.'/header.htm')?>
|
||||
<?=file_get_contents(BASEDIR.'/header.htm')?>
|
||||
<?=$content?>
|
||||
</div>
|
||||
</div>
|
||||
@ -436,8 +426,30 @@ function buildcommon() {
|
||||
}
|
||||
|
||||
function main($args) {
|
||||
$total = $args[0];
|
||||
$pos = $args[1];
|
||||
$basedir = './'; //$args[0];
|
||||
$total = $args[0];
|
||||
$pos = $args[1];
|
||||
|
||||
// Parse configuration
|
||||
|
||||
$config = @parse_ini_file(
|
||||
$basedir . 'config.ini',
|
||||
true,
|
||||
INI_SCANNER_RAW
|
||||
);
|
||||
|
||||
if ($config === false) {
|
||||
die("[FATAL] Couldn't load '${basedir}/config.ini'!\n");
|
||||
}
|
||||
|
||||
define('BASEDIR', $basedir);
|
||||
define('SITE_TITLE', trim($config['codesite']['title']));
|
||||
define('PAGE_THUMB_W', intval($config['codesite']['page_thumb_w']));
|
||||
define('PAGE_THUMB_H', intval($config['codesite']['page_thumb_h']));
|
||||
define('INDEX_THUMB_W', intval($config['codesite']['index_thumb_w']));
|
||||
define('INDEX_THUMB_H', intval($config['codesite']['index_thumb_h']));
|
||||
|
||||
// Perform build tasks
|
||||
|
||||
if ($pos == 0) {
|
||||
buildcommon();
|
||||
|
58
rebuild.sh
@ -2,18 +2,58 @@
|
||||
|
||||
set -eu
|
||||
PHP=/cygdrive/c/bin/php/php.exe
|
||||
THREADS=4
|
||||
|
||||
echo Cleaning target directory...
|
||||
buildsite() {
|
||||
|
||||
rm -r wwwroot
|
||||
mkdir -p wwwroot/srv
|
||||
cp static/* wwwroot
|
||||
local rebuild="$(realpath ./rebuild.php)"
|
||||
|
||||
if [[ "$(uname -o)" == "Cygwin" ]] ; then
|
||||
rebuild="$(cygpath -w "$rebuild")"
|
||||
fi
|
||||
|
||||
echo Building pages...
|
||||
echo "Site: ${1}"
|
||||
|
||||
for i in $(seq 0 4) ; do
|
||||
$PHP rebuild.php 4 "$i" &
|
||||
done
|
||||
wait
|
||||
pushd "$1" >/dev/null
|
||||
|
||||
echo "Cleaning target directory..."
|
||||
|
||||
if [[ -d wwwroot ]] ; then
|
||||
rm -r wwwroot
|
||||
fi
|
||||
|
||||
mkdir -p wwwroot/srv
|
||||
|
||||
if [[ ! -d static ]] ; then
|
||||
mkdir static
|
||||
fi
|
||||
cp static/* wwwroot || true
|
||||
|
||||
for htm in footer header homepage_blurb ; do
|
||||
if [[ ! -f "${htm}.htm" ]] ; then
|
||||
touch "${htm}.htm"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Building pages..."
|
||||
|
||||
for i in $(seq 0 "$THREADS") ; do
|
||||
$PHP "$rebuild" "$THREADS" "$i" &
|
||||
done
|
||||
wait
|
||||
|
||||
echo "Site: ${1} finished."
|
||||
echo ""
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
main() {
|
||||
for site in sites/* ; do
|
||||
buildsite "$site"
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
read -p "Press any key to continue..."
|
||||
|
8
sites/code.ivysaur.me/config.ini
Normal file
@ -0,0 +1,8 @@
|
||||
[codesite]
|
||||
title=code.ivysaur.me
|
||||
page_thumb_w=60
|
||||
page_thumb_h=60
|
||||
index_thumb_w=90
|
||||
index_thumb_h=32
|
||||
|
||||
; n.b. Recommend a multiple of the JPEG iDCT block size for index_thumb_h
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |