diff --git a/gosa-core/update-gosa b/gosa-core/update-gosa
index 2e54a2aa91df52e7754e3796cd2081bbfb45c1cb..7e65804a7cebddf8339ab96e936317a09febf2a7 100755 (executable)
--- a/gosa-core/update-gosa
+++ b/gosa-core/update-gosa
<?php
/*
* This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
+ * Copyright (C) 2003-2010 GONICUS GmbH
*
* ID: $$Id: main.php 9254 2008-03-03 15:57:49Z cajus $$
*
update-gosa rescan-i18n Rebuilds the translations
+ update-gosa rescan-images Rebuilds the themes master image
+
update-gosa rescan-classes Rebuilds the class list
update-gosa Shortcut for rescan-classes and rescan-i18n
}
+function get_themes()
+{
+ $themes= array();
+ $d = dir(GOSA_HOME."/html/themes");
+ while (false !== ($entry = $d->read())) {
+ if ($entry[0] != '.') {
+ $themes[]= basename($entry);
+ }
+ }
+ $d->close();
+
+ return $themes;
+}
+
/* Function to include all class_ files starting at a given directory base */
function get_classes($folder= ".")
{
}
$dh = opendir(".");
- while(false !== ($file = readdir($dh))){
+ while(is_resource($dh) && false !== ($file = readdir($dh))){
if (preg_match("/.*\.svn.*/", $file) ||
preg_match("/.*smarty.*/i",$file) ||
}
/* Recurse through all "common" directories */
- if (is_dir($file)){
+ if (is_dir($file) && !file_exists("{$file}/excludeFromAutoLoad")){
get_classes($file);
continue;
}
}
}
- closedir($dh);
+ @closedir($dh);
chdir($currdir);
return ($result);
}
-function rescan_guide()
-{
- $master_guide= "doc/guide.xml";
- echo "Updating Online Help Index...\n";
- $master_guide_content="<?xml version=\"1.0\"?>\n".
- "<!--\n".
- "\tWARNING:\n".
- "\tThis file is automatically generated by update-online-help.\n".
- "\tIf you want to add entries, use doc/core/guide.xml or doc/plugins/\"Appropriate Plugin Directory\"/guide.xml.\n".
- "\tThen execute update-online-help to merge them into this file.\n".
- "-->\n\n".
- "<!--\n".
- "\tThis xml file specifies which class is documented in which help file.\n".
- "\tIf isset ( \$_SESSION['current_class_for_help'] ) then open the helpfile which is\n".
- "\tspecified for this class below.\n".
- "-->\n\n".
- "<!--\n".
- "\t<ENTRY NAME='class name' VALUE='displayed text' PATH='path to helpfiles' FILE='path to htmlfile' />\n".
- "\tLeave blank to display message \"There is no helpfile specified for this class.\"\n".
- "-->\n".
- "<ENTRIES>\n";
-
- $guide= 'doc/core/guide.xml';
- if(file_exists($guide) && is_readable($guide)) {
- $master_guide_content.= file_get_contents($guide);
- }
-
- if(file_exists('doc/plugins')) {
- $plugins= scandir('doc/plugins');
- foreach($plugins as $key => $plugin) {
- if($plugin != '.' && $plugin != '..') {
- if(is_dir('doc/plugins/'.$plugin)) {
- $guide= 'doc/plugins/'.$plugin.'/guide.xml';
- if(file_exists($guide) && is_readable($guide)) {
- $master_guide_content.= file_get_contents($guide);
- }
- }
- }
- }
- }
-
- $master_guide_content.= "</ENTRIES>";
-
- $master_guide_content= preg_replace("/[ \t][ \t]*/", " ", $master_guide_content);
-
- if((file_exists($master_guide) && is_writable($master_guide)) || is_writable('doc')) {
- file_put_contents($master_guide, $master_guide_content);
- }
-
-}
-
-
function parse_ini($file)
{
global $description, $provides, $depends, $versions, $conflicts;
/* Update caches */
rescan_classes();
rescan_i18n();
- rescan_guide();
}
/* Update caches */
rescan_classes();
rescan_i18n();
- rescan_guide();
}
$styles= array();
$duplicates= array();
+ echo "Updating master image for theme '$theme'...";
+
// Check for image magick convert
if (!function_exists("imageFilter")){
exec("which convert", $res, $ret);
}
// Scan for images in the given path
- echo "Scanning for images";
flush();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $fileInfo) {
// Grey image if it is not already one
if (preg_match('/grey/', $indexPath)) {
echo "!";
- $warnings[]= "Warning: skipped possible *grey* image $path";
+ $warnings[]= "! Warning: skipped possible *grey* image $path";
flush();
continue;
}
// New image if it is not already one
if (preg_match('/new/', $indexPath) && !preg_match('/new\.png$/', $indexPath)) {
echo "!";
- $warnings[]= "Warning: skipped possible *new* image $path";
+ $warnings[]= "! Warning: skipped possible *new* image $path";
flush();
continue;
}
// Is this image already there?
$checksum= md5_file($path);
if (in_array($checksum, $checksums)) {
- $warnings[]= "Warning: images $indexPath seems to be a duplicate of ".array_search($checksum, $checksums);
+ $warnings[]= "! Warning: images $indexPath seems to be a duplicate of ".array_search($checksum, $checksums);
$duplicates[$indexPath]= array_search($checksum, $checksums);
$duplicates[$greyIndexPath]= preg_replace('/\.png$/', '-grey.png', array_search($checksum, $checksums));
continue;
$styles[$imagePath]= $styles[$realPath];
}
- imagePNG($dst, "html/themes/$theme/images/img.png", 9);
+ imagePNG($dst, GOSA_HOME."/html/themes/$theme/images/img.png", 9);
imageDestroy($dst);
// Show warnings images
// Write styles
echo "Writing styles...";
- $fp = fopen("ihtml/themes/$theme/img.styles", 'w');
+ $fp = fopen(GOSA_HOME."/ihtml/themes/$theme/img.styles", 'w');
fwrite($fp, serialize($styles));
fclose($fp);
if ($argc < 2){
rescan_classes();
rescan_i18n();
- rescan_guide();
- rescan_images("html", "modern");
- exit (0);
+ foreach (get_themes() as $theme) {
+ rescan_images(GOSA_HOME."/html", $theme);
+ }
+ exit (0);
}
switch ($argv[1]){
rescan_classes();
break;
case 'rescan-images':
- rescan_images("html", "modern");
+ foreach (get_themes() as $theme) {
+ rescan_images("html", $theme);
+ }
break;
default:
echo "Error: Supplied command not known\n\n";