| 1 |
#!/usr/bin/php -q |
|---|
| 2 |
<?php |
|---|
| 3 |
//This file is part of FreePBX. |
|---|
| 4 |
// |
|---|
| 5 |
// FreePBX is free software: you can redistribute it and/or modify |
|---|
| 6 |
// it under the terms of the GNU General Public License as published by |
|---|
| 7 |
// the Free Software Foundation, either version 2 of the License, or |
|---|
| 8 |
// (at your option) any later version. |
|---|
| 9 |
// |
|---|
| 10 |
// FreePBX is distributed in the hope that it will be useful, |
|---|
| 11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 |
// GNU General Public License for more details. |
|---|
| 14 |
// |
|---|
| 15 |
// You should have received a copy of the GNU General Public License |
|---|
| 16 |
// along with FreePBX. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 |
// |
|---|
| 18 |
// Copyright 2007, Philippe Lindheimer |
|---|
| 19 |
// |
|---|
| 20 |
|
|---|
| 21 |
/** setup_svn.php |
|---|
| 22 |
* |
|---|
| 23 |
* The purpose of this function is to install all the modules associated with a particular FreePBX version |
|---|
| 24 |
* under the same path as install_amp. The setup will be similar to how modules are packaged with the |
|---|
| 25 |
* tarballs when distributed. There are a handful of files that disapear and a few that appear as a |
|---|
| 26 |
* result of this technique, but all of those files are associated with the packaging of distros and |
|---|
| 27 |
* not the actual functioning of FreePBX. |
|---|
| 28 |
* |
|---|
| 29 |
* You can not publish modules from a tree like this. However, you can do svn udpates from the top level |
|---|
| 30 |
* and then reinstall, and you can make changes in place and do 'svn ci' commands to get them back into |
|---|
| 31 |
* svn. You will require a 'properly' setup svn pull of the module tree in order to do the final publishing. |
|---|
| 32 |
* |
|---|
| 33 |
* however, you can use this mode in conjunction with the --make-links-devel install option to get all of your |
|---|
| 34 |
* modules sym-linked to their final place to make development easier. |
|---|
| 35 |
* |
|---|
| 36 |
*/ |
|---|
| 37 |
$VERSION = "2.9"; |
|---|
| 38 |
|
|---|
| 39 |
exec('svn info --xml .', $output, $ret); |
|---|
| 40 |
if ($ret) { |
|---|
| 41 |
echo "Failed determining the reporistory path\n"; |
|---|
| 42 |
exit(1); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
$path = false; |
|---|
| 46 |
foreach ($output as $line) { |
|---|
| 47 |
if (strpos($line,'<root>') === 0) { |
|---|
| 48 |
$path = trim(str_replace(array('<root>','</root>'),array('',''),$line)); |
|---|
| 49 |
break; |
|---|
| 50 |
} |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
if ($path === false) { |
|---|
| 54 |
echo "Failed parsing svn path\n"; |
|---|
| 55 |
exit(1); |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
echo "\nFound current svn path: \n$path\n\n"; |
|---|
| 59 |
|
|---|
| 60 |
$NORMAL_URL = $path . "/freepbx/branches/$VERSION/amp_conf/htdocs/admin/modules"; |
|---|
| 61 |
$MODULE_URL = $path . "/modules/branches/$VERSION"; |
|---|
| 62 |
$MODULE_PATH = "./amp_conf/htdocs/admin/modules"; |
|---|
| 63 |
|
|---|
| 64 |
/* |
|---|
| 65 |
echo "NORMAL_URL: $NORMAL_URL\n"; |
|---|
| 66 |
echo "MODULE_URL: $MODULE_URL\n"; |
|---|
| 67 |
exit; |
|---|
| 68 |
*/ |
|---|
| 69 |
|
|---|
| 70 |
if (isset($argv[1]) && strtolower($argv[1]) == "restore") { |
|---|
| 71 |
system("svn switch $NORMAL_URL $MODULE_PATH"); |
|---|
| 72 |
} else { |
|---|
| 73 |
system("svn switch $MODULE_URL $MODULE_PATH"); |
|---|
| 74 |
} |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
/* |
|---|
| 78 |
exec("svn list $MODULE_URL", $modules, $ret); |
|---|
| 79 |
|
|---|
| 80 |
if ($ret) { |
|---|
| 81 |
echo "ERROR: svn list returned: $ret\n"; |
|---|
| 82 |
exit; |
|---|
| 83 |
} else { |
|---|
| 84 |
|
|---|
| 85 |
foreach ($modules as $module) { |
|---|
| 86 |
echo "Checking out $module to $MODULE_PATH/$module\n"; |
|---|
| 87 |
system("svn co $MODULE_URL/$module $MODULE_PATH/$module"); |
|---|
| 88 |
} |
|---|
| 89 |
} |
|---|
| 90 |
*/ |
|---|
| 91 |
?> |
|---|