Ejemplo n.º 1
0
        $modinfo = pathinfo($po);
        $module = $modinfo['filename'] == 'amp' ? 'framework' : $modinfo['filename'];
        if ($module != 'framework') {
            $i18n = $htdocs_dest . "/admin/modules/" . $module . "/i18n";
            if (!file_exists($htdocs_dest . "/admin/modules/" . $module)) {
                continue;
            }
        } else {
            $i18n = $htdocs_dest . "/admin/i18n";
        }
        if (!file_exists($i18n . "/" . $lang . "/LC_MESSAGES")) {
            mkdir($i18n . "/" . $lang . "/LC_MESSAGES", 0777, true);
        }
        exec("cp -ru " . $po . " " . $i18n . "/" . $lang . "/LC_MESSAGES/" . basename($po) . " 2>&1", $out, $ret);
        if ($ret != 0) {
            fw_langpacks_print_errors($po, $i18n . "/" . $lang . "/LC_MESSAGES/" . basename($po), $out);
        } else {
            out(sprintf(_("Updated %s"), basename($po)));
        }
    }
}
// We now delete the files, this makes sure that if someone had an unprotected system where they have not enabled
// the .htaccess files or otherwise allowed direct access, that these files are not around to possibly cause problems
//
out(_("fw_langpacks po file install done, removing packages from module"));
unset($out);
exec("rm -rf {$htdocs_po_source} 2>&1", $out, $ret);
if ($ret != 0) {
    out(_("an error occured removing the packaged files"));
} else {
    out(_("files removed successfully"));
Ejemplo n.º 2
0
$htdocs_copy[] = array("source" => "{$htdocs_source}/admin/i18n", "dest" => "{$htdocs_dest}/admin");
// If ARI is there copy those
//
if (is_dir("{$htdocs_dest}/recordings")) {
    $htdocs_copy[] = array("source" => "{$htdocs_source}/recordings", "dest" => "{$htdocs_dest}");
    out(sprintf(_("Preparing to copy %s to %s"), 'recordings', "{$htdocs_dest}"));
} else {
    out(sprintf(_("No destination directory %s to copy %s to"), "{$htdocs_dest}/recordings", "recordings"));
}
// Now for each module we have, make sure the module is in the destination as we don't want to create
// empty destinatino folders with just i18n directories.
//
$dir = opendir($htdocs_source . '/admin/modules');
while ($file = readdir($dir)) {
    if (is_dir("{$htdocs_dest}/admin/modules/{$file}") && $file != "." && $file != "..") {
        out(sprintf(_("Preparing to copy %s to %s"), "{$file}", "{$htdocs_dest}/admin/modules"));
        $htdocs_copy[] = array("source" => "{$htdocs_source}/admin/modules/{$file}", "dest" => "{$htdocs_dest}/admin/modules");
    } else {
        if ($file != "." && $file != "..") {
            out(sprintf(_("No destination directory %s to copy %s to"), "{$htdocs_dest}/modules/{$file}", "{$file}"));
        }
    }
}
foreach ($htdocs_copy as $translations) {
    exec("cp -ru " . $translations['source'] . " " . $translations['dest'] . " 2>&1", $out, $ret);
    if ($ret != 0) {
        fw_langpacks_print_errors($translations['source'], $translations['dest'], $out);
    } else {
        out(sprintf(_("Updated %s"), basename($translations['source'])));
    }
}