| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
function fw_langpacks_print_errors($src, $dst, $errors) { |
|---|
| 6 |
echo "error copying fw_langpacks files:<br />'cp -rf' from src: '$src' to dst: '$dst'...details follow<br />"; |
|---|
| 7 |
foreach ($errors as $error) { |
|---|
| 8 |
echo "$error<br />"; |
|---|
| 9 |
} |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
if (! function_exists('out')) { |
|---|
| 13 |
function out($text) { |
|---|
| 14 |
echo $text."<br>"; |
|---|
| 15 |
} |
|---|
| 16 |
} |
|---|
| 17 |
|
|---|
| 18 |
if (! function_exists('outn')) { |
|---|
| 19 |
function outn($text) { |
|---|
| 20 |
echo $text; |
|---|
| 21 |
} |
|---|
| 22 |
} |
|---|
| 23 |
|
|---|
| 24 |
if (! function_exists('error')) { |
|---|
| 25 |
function error($text) { |
|---|
| 26 |
echo "[ERROR] ".$text."<br>"; |
|---|
| 27 |
} |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
if (! function_exists('fatal')) { |
|---|
| 31 |
function fatal($text) { |
|---|
| 32 |
echo "[FATAL] ".$text."<br>"; |
|---|
| 33 |
exit(1); |
|---|
| 34 |
} |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
if (! function_exists('debug')) { |
|---|
| 38 |
function debug($text) { |
|---|
| 39 |
global $debug; |
|---|
| 40 |
|
|---|
| 41 |
if ($debug) echo "[DEBUG-preDB] ".$text."<br>"; |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
global $amp_conf; |
|---|
| 46 |
|
|---|
| 47 |
$debug = false; |
|---|
| 48 |
$dryrun = false; |
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
if (!function_exists('version_compare_freepbx')) { |
|---|
| 55 |
function version_compare_freepbx($version1, $version2, $op = null) { |
|---|
| 56 |
$version1 = str_replace("rc","RC", strtolower($version1)); |
|---|
| 57 |
$version2 = str_replace("rc","RC", strtolower($version2)); |
|---|
| 58 |
if (!is_null($op)) { |
|---|
| 59 |
return version_compare($version1, $version2, $op); |
|---|
| 60 |
} else { |
|---|
| 61 |
return version_compare($version1, $version2); |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
$htdocs_source = dirname(__FILE__)."/htdocs"; |
|---|
| 74 |
$htdocs_dest = $amp_conf['AMPWEBROOT']; |
|---|
| 75 |
|
|---|
| 76 |
file_exists($htdocs_source)) { |
|---|
| 77 |
out(sprintf(_("No directory %s, install script not needed"),$htdocs_source)); |
|---|
| 78 |
true; |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
out(sprintf(_("Preparing to copy %s to %s"),'i18n',"$htdocs_dest/admin")); |
|---|
| 84 |
$htdocs_copy[] = array("source" => "$htdocs_source/admin/i18n", "dest" => "$htdocs_dest/admin"); |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
if (is_dir("$htdocs_dest/recordings")) { |
|---|
| 89 |
$htdocs_copy[] = array("source" => "$htdocs_source/recordings", "dest" => "$htdocs_dest"); |
|---|
| 90 |
out(sprintf(_("Preparing to copy %s to %s"),'recordings',"$htdocs_dest")); |
|---|
| 91 |
|
|---|
| 92 |
out(sprintf(_("No destination directory %s to copy %s to"),"$htdocs_dest/recordings","recordings")); |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
$dir = opendir($htdocs_source.'/admin/modules'); |
|---|
| 99 |
$file = readdir($dir)) { |
|---|
| 100 |
is_dir("$htdocs_dest/admin/modules/$file") && ($file != ".") && ($file != "..")) { |
|---|
| 101 |
out(sprintf(_("Preparing to copy %s to %s"),"$file","$htdocs_dest/admin/modules")); |
|---|
| 102 |
$htdocs_copy[] = array("source" => "$htdocs_source/admin/modules/$file", "dest" => "$htdocs_dest/admin/modules"); |
|---|
| 103 |
$file != "." && $file != "..") { |
|---|
| 104 |
out(sprintf(_("No destination directory %s to copy %s to"),"$htdocs_dest/modules/$file","$file")); |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
$htdocs_copy as $translations) { |
|---|
| 109 |
exec("cp -ru ".$translations['source']." ".$translations['dest']." 2>&1",$out,$ret); |
|---|
| 110 |
$ret != 0) { |
|---|
| 111 |
fw_langpacks_print_errors($translations['source'], $translations['dest'], $out); |
|---|
| 112 |
|
|---|
| 113 |
out(sprintf(_("Updated %s"),basename($translations['source']))); |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
?> |
|---|
| 117 |
|
|---|