function compile($options) { $config = getZombieConfig(); $root = $config['zombie_root']; if (@(include __DIR__ . "/../../../config/version.php")) { $old_version = version(); } else { $old_version = array('css' => 'css', 'js' => 'js', 'images' => 'images'); } $version = uniqid(); $compile_css = false; $compile_js = false; $compile_images = false; $compile_templates = false; if (isset($options['css'])) { $compile_css = true; $compile_js = true; $compile_templates = true; } if (isset($options['js'])) { $compile_js = true; $compile_css = true; $compile_templates = true; } if (isset($options['images'])) { $compile_images = true; $compile_css = true; $compile_templates = true; } if (isset($options['templates'])) { $compile_templates = true; } if (isset($options['all']) || !$compile_css && !$compile_js && !$compile_images && !$compile_templates) { $compile_css = true; $compile_js = true; $compile_images = true; $compile_templates = true; } $css_version = $compile_css ? $version : $old_version['css']; $js_version = $compile_js ? $version : $old_version['js']; $images_version = $compile_images ? $version : $old_version['images']; writeVersion($css_version, $js_version, $images_version); if ($compile_css) { compileCss($css_version, $old_version['css'], $images_version); } if ($compile_templates) { compileTemplates(); } if ($compile_js) { compileJs($js_version, $old_version['js'], $css_version, $images_version); } if ($compile_images) { copyImages($images_version, $old_version['images']); } }
$m = preg_replace("@\\|.*@im", "", $m); $images[] = $m; } } $mw[] = array($t, $r->getText()); } /* // debug images foreach ($images as $m) { $t = Title::makeTitle(NS_IMAGE, $m); $img = wfLocalFile( $t, false); echo $t->getFullText() . "\t" . $img->getPath() . "\n"; } exit; */ copyImages($images); echo "Grabbing mediawiki messages\n"; // get all of the mediawiki messages $res = $dbr->select('page', array('page_namespace', 'page_title'), array('page_namespace in (' . NS_MEDIAWIKI . ', ' . NS_TEMPLATE . ', ' . NS_CATEGORY . ')')); while ($row = $dbr->fetchObject($res)) { $t = Title::makeTitle($row->page_namespace, $row->page_title); $r = Revision::newFromTitle($t); $mw[] = array($t, $r->getText()); } echo "Grabbing image pages and image table rows\n"; // get all of the image pages $img_rows = array(); $files = array(); foreach ($images as $m) { $t = Title::makeTitle(NS_IMAGE, $m); $a = new Article($t);
if (copy($source . $file, $destination . $file)) { $delete[] = $source . $file; echo '<p>Header ' . $source . $file . " successfully copied!</p>"; } else { echo '<p>Warning: Header file ' . $source . $file . " not copied!</p>"; } } // Delete all successfully-copied files foreach ($delete as $file) { unlink($file); } return 1; } copyImages(HEADERS_DIR, $attachmentsPath); rmdir(HEADERS_DIR); copyImages(LOGOS_DIR, $attachmentsPath); rmdir(LOGOS_DIR); /** * * DATABASE * */ $db = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD); $db->exec('set names utf8'); /** * * ATTACHMENTS * */ function insertAttachedFile($connection, $postId, $fileName, $meta) {