function composer_ALL(Web $w) { echo "<pre>" . file_get_contents(ROOT_PATH . '/log/composer.log') . "</pre>"; // Collect dependencies $dependencies_array = array(); foreach ($w->modules() as $module) { $dependencies = Config::get("{$module}.dependencies"); if (!empty($dependencies)) { $dependencies_array = array_merge($dependencies, $dependencies_array); } } $json_obj = array(); $json_obj["config"] = array(); $json_obj["config"]["vendor-dir"] = 'composer/vendor'; $json_obj["config"]["cache-dir"] = 'composer/cache'; $json_obj["config"]["bin-dir"] = 'composer/bin'; $json_obj["require"] = $dependencies_array; // Need to change dir so composer can find the json file chdir(SYSTEM_PATH); // Create the JSON file file_put_contents(SYSTEM_PATH . "/composer.json", json_encode($json_obj, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT)); //Create the commands $input = new ArrayInput(array('command' => 'update', '--prefer-dist' => 'true')); $filestream = new StreamOutput(fopen(ROOT_PATH . '/log/composer.log', 'w')); //Create the application and run it with the commands $application = new Application(); $exitcode = $application->run($input, $filestream); // Change dir back to root chdir(ROOT_PATH); // This doesn't happen for some reason $w->msg("Composer update return exit code " . $exitcode . " (0 is OK)<br/>Check the /log/composer.log for output", "/admin"); }
function addwidget_GET(Web $w) { $p = $w->pathMatch("module"); $module = $p["module"]; $modulelist = $w->modules(); $modules = array_filter($modulelist, function ($module) use(&$w) { $names = $w->Widget->getWidgetNamesForModule($module); return !empty($names); }); $form = array("Add a widget" => array(array(array("Source module", "select", "source_module", null, $modules)), array(array("Widget Name", "select", "widget_name", null, array())))); $w->ctx("widgetform", Html::multiColForm($form, "/main/addwidget/{$module}", "POST", "Add")); }
/** * Show a Table of Contents by searching * through all modules for the file * ./help/<module>_toc.help * * @param \Web $w */ function toc_GET(Web $w) { foreach ($w->modules() as $h) { $p = HelpLib::getHelpFilePath($w, $h, null, $h . "_toc"); if ($p) { $tocs[$h] = $p; } } foreach ($tocs as $module => $path) { if ($w->Auth->allowed($module . '/index')) { $content = file_get_contents($path); $title = HelpLib::extractTitle($content); $ul[] = Html::a(WEBROOT . '/help/view/' . $module . '/' . $module . '_toc', $title ? $title : ucfirst($module)); } } $w->ctx("ul", Html::ul($ul)); }