function updateAutoload($tpl = null) { $autoloadGenerator = new eZAutoloadGenerator(); try { $autoloadGenerator->buildAutoloadArrays(); $messages = $autoloadGenerator->getMessages(); foreach ($messages as $message) { eZDebug::writeNotice($message, 'eZAutoloadGenerator'); } $warnings = $autoloadGenerator->getWarnings(); foreach ($warnings as &$warning) { eZDebug::writeWarning($warning, "eZAutoloadGenerator"); // For web output we want to mark some of the important parts of // the message $pattern = '@^Class\\s+(\\w+)\\s+.* file\\s(.+\\.php).*\\n(.+\\.php)\\s@'; preg_match($pattern, $warning, $m); $warning = str_replace($m[1], '<strong>' . $m[1] . '</strong>', $warning); $warning = str_replace($m[2], '<em>' . $m[2] . '</em>', $warning); $warning = str_replace($m[3], '<em>' . $m[3] . '</em>', $warning); } if ($tpl !== null) { $tpl->setVariable('warning_messages', $warnings); } } catch (Exception $e) { eZDebug::writeError($e->getMessage()); } }
protected static function initializeAutoload() { $autoloadOptions = new ezpAutoloadGeneratorOptions(); $autoloadOptions->basePath = 'extension/ezdbintegrity'; $autoloadOptions->searchKernelFiles = false; $autoloadOptions->searchKernelOverride = false; $autoloadOptions->searchExtensionFiles = true; $autoloadOptions->searchTestFiles = false; $autoloadOptions->writeFiles = false; $autoloadOptions->displayProgress = false; $autoloadGenerator = new eZAutoloadGenerator($autoloadOptions); // We have to jump through hoops to get eZAutoloadGenerator give us back an array $autoloadGenerator->setOutputCallback(array('ezdbiAutoloadHelper', 'autoloadCallback')); try { $autoloadGenerator->buildAutoloadArrays(); $autoloadGenerator->printAutoloadArray(); } catch (Exception $e) { echo $e->getMessage() . "\n"; } }
/** * Uses the walker in ezcBaseFile to find files. * * This also uses the callback to get progress information about the file search. * * @param string $sourceDir * @param array $includeFilters * @param array $excludeFilters * @param eZAutoloadGenerator $gen * @return array */ public static function findRecursive($sourceDir, array $includeFilters = array(), array $excludeFilters = array(), eZAutoloadGenerator $gen) { $gen->log("Scanning for PHP-files."); $gen->startProgressOutput(self::OUTPUT_PROGRESS_PHASE1); // create the context, and then start walking over the array $context = new ezpAutoloadFileFindContext(); $context->generator = $gen; self::walkRecursive($sourceDir, $includeFilters, $excludeFilters, array('eZAutoloadGenerator', 'findRecursiveCallback'), $context); // return the found and pattern-matched files sort($context->elements); $gen->stopProgressOutput(self::OUTPUT_PROGRESS_PHASE1); $gen->log("Scan complete. Found {$context->count} PHP files."); return $context->elements; }
public static function updateExtensionAutoloadArray() { $autoloadGenerator = new eZAutoloadGenerator(); try { $autoloadGenerator->buildAutoloadArrays(); self::reset(); } catch (Exception $e) { echo $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(); } }
} else { $excludeDirs = array(); } $autoloadOptions = new ezpAutoloadGeneratorOptions(); $autoloadOptions->basePath = $params->argumentDefinition['extension']->value; $autoloadOptions->searchKernelFiles = $kernelFilesOption->value; $autoloadOptions->searchKernelOverride = $kernelOverrideOption->value; $autoloadOptions->searchExtensionFiles = $extensionFilesOption->value; $autoloadOptions->searchTestFiles = $testFilesOption->value; $autoloadOptions->writeFiles = !$dryrunOption->value; $autoloadOptions->displayProgress = $displayProgressOption->value; if (!empty($targetOption->value)) { $autoloadOptions->outputDir = $targetOption->value; } $autoloadOptions->excludeDirs = $excludeDirs; $autoloadGenerator = new eZAutoloadGenerator($autoloadOptions); if (defined('EZP_AUTOLOAD_OUTPUT')) { $outputClass = EZP_AUTOLOAD_OUTPUT; $autoloadCliOutput = new $outputClass(); } else { $autoloadCliOutput = new ezpAutoloadCliOutput(); } $autoloadGenerator->setOutputObject($autoloadCliOutput); $autoloadGenerator->setOutputCallback(array($autoloadCliOutput, 'outputCli')); try { $autoloadGenerator->buildAutoloadArrays(); $autoloadGenerator->buildPHPUnitConfigurationFile(); // If we are showing progress output, let's print the list of warnings at // the end. if ($displayProgressOption->value) { $warningMessages = $autoloadGenerator->getWarnings();