X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fupdate-gosa;h=7e65804a7cebddf8339ab96e936317a09febf2a7;hb=2e14fc223c17fb1f7e5527ab0d1306b08b391f5b;hp=2e54a2aa91df52e7754e3796cd2081bbfb45c1cb;hpb=91e25880974f35947930122da73b5d89bd779cdc;p=gosa.git diff --git a/gosa-core/update-gosa b/gosa-core/update-gosa index 2e54a2aa9..7e65804a7 100755 --- a/gosa-core/update-gosa +++ b/gosa-core/update-gosa @@ -2,7 +2,7 @@ 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= ".") { @@ -81,7 +97,7 @@ 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) || @@ -91,7 +107,7 @@ function get_classes($folder= ".") } /* Recurse through all "common" directories */ - if (is_dir($file)){ + if (is_dir($file) && !file_exists("{$file}/excludeFromAutoLoad")){ get_classes($file); continue; } @@ -112,7 +128,7 @@ function get_classes($folder= ".") } } - closedir($dh); + @closedir($dh); chdir($currdir); return ($result); @@ -193,58 +209,6 @@ function rescan_i18n() } -function rescan_guide() -{ - $master_guide= "doc/guide.xml"; - echo "Updating Online Help Index...\n"; - $master_guide_content="\n". - "\n\n". - "\n\n". - "\n". - "\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.= ""; - - $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; @@ -459,7 +423,6 @@ function install_plugin($file) /* Update caches */ rescan_classes(); rescan_i18n(); - rescan_guide(); } @@ -517,7 +480,6 @@ function remove_plugin($name) /* Update caches */ rescan_classes(); rescan_i18n(); - rescan_guide(); } @@ -535,6 +497,8 @@ function rescan_images($path, $theme) $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); @@ -544,7 +508,6 @@ function rescan_images($path, $theme) } // Scan for images in the given path - echo "Scanning for images"; flush(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $fileInfo) { @@ -556,7 +519,7 @@ function rescan_images($path, $theme) // 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; } @@ -564,7 +527,7 @@ function rescan_images($path, $theme) // 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; } @@ -584,7 +547,7 @@ function rescan_images($path, $theme) // 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; @@ -739,7 +702,7 @@ function rescan_images($path, $theme) $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 @@ -749,7 +712,7 @@ function rescan_images($path, $theme) // 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); @@ -764,9 +727,10 @@ $description= $provides= $depends= $versions= $conflicts= array(); 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]){ @@ -796,7 +760,9 @@ 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";