root/freepbx/trunk/amp_conf/bin/retrieve_conf

Revision 13650, 34.2 kB (checked in by p_lindheimer, 3 months ago)

Merged revisions 12625-12626,12628,12641-12643,12645-12652,12654-12655,12657,12663-12664,12666,12668,12681,12686-12689,12696,12713-12714,12716-12720,12726-12728,12730-12732,12757,12764-12765,12774,12776-12777,12802-12805,12808-12812,12816-12818,12820,12823-12825,12827,12836-12838,12841-12842,12845,12861,12873,12879,12882,12902,12916,12918,12931-12932,12941,12949-12953,12957,12962-12964,12968,12970,12973,12976,12978,12983,12986-12990,12992-12996,13047-13048,13050,13053-13054,13065,13071-13073,13075-13076,13078-13079,13081,13083-13084,13086-13087,13097-13100,13110,13119,13124-13125,13127-13133,13142,13150,13153-13154,13158-13159,13167,13190,13193-13194,13197,13200,13205,13208-13210,13232,13245-13247,13259-13260,13263,13391-13393,13396,13399-13400,13405-13406,13433,13438,13443,13453,13459,13477,13481,13483,13491,13540,13560-13561,13564,13570,13579-13580,13584,13587,13591,13594,13598,13604,13623-13624,13634-13635 via svnmerge from
http://www.freepbx.org/v2/svn/freepbx/branches/2.10

................

r12625 | p_lindheimer | 2011-09-21 10:17:09 -0700 (Wed, 21 Sep 2011) | 9 lines


Merged revisions 12624 via svnmerge from
http://www.freepbx.org/v2/svn/freepbx/trunk


........

r12624 | mbrevda | 2011-09-21 10:09:35 -0700 (Wed, 21 Sep 2011) | 1 line


re #5342 - fix js packer, remove compression variable - were defaulting to compression for now and can esially do another version that is uncompressed if people have issues

........

................

r12626 | p_lindheimer | 2011-09-21 10:18:26 -0700 (Wed, 21 Sep 2011) | 1 line


make build directory structures more generic

................

r12628 | p_lindheimer | 2011-09-21 10:20:31 -0700 (Wed, 21 Sep 2011) | 1 line


Creating release 2.10.0beta1

................

r12641 | mbrevda | 2011-09-21 14:12:19 -0700 (Wed, 21 Sep 2011) | 1 line


closes #5370 - closing dialog post module actions should return to the previous page

................

r12642 | mbrevda | 2011-09-21 14:14:05 -0700 (Wed, 21 Sep 2011) | 1 line


closes #5370 - closing dialog post module actions should return to the previous page

................

r12643 | p_lindheimer | 2011-09-21 15:03:13 -0700 (Wed, 21 Sep 2011) | 1 line


at least some systems fail fataly when writing to a file greater than 2G so put some safety measures into the dbug() and freepbx_log() calls to avoid this

................

r12645 | mbrevda | 2011-09-21 21:36:50 -0700 (Wed, 21 Sep 2011) | 1 line


fix regex

................

r12646 | mbrevda | 2011-09-22 09:13:07 -0700 (Thu, 22 Sep 2011) | 1 line


re #5342 - fix for wide screens

................

r12647 | mbrevda | 2011-09-22 09:17:05 -0700 (Thu, 22 Sep 2011) | 1 line


re #5342 - fix for wide screens; rtl

................

r12648 | mbrevda | 2011-09-22 09:39:35 -0700 (Thu, 22 Sep 2011) | 1 line


re #5342 - no need for the same link twice

................

r12649 | mbrevda | 2011-09-22 11:17:41 -0700 (Thu, 22 Sep 2011) | 1 line


re #5342 - add sponsor in footer

................

r12650 | mbrevda | 2011-09-22 11:24:44 -0700 (Thu, 22 Sep 2011) | 1 line


re #5342 - add sponsor in footer

................

r12651 | mbrevda | 2011-09-22 11:28:20 -0700 (Thu, 22 Sep 2011) | 1 line


re #5342 - minor cleanup

................

r12652 | mickecarlsson | 2011-09-22 11:28:49 -0700 (Thu, 22 Sep 2011) | 1 line


fix dbug error, logic was wrong

................

r12654 | p_lindheimer | 2011-09-22 11:44:48 -0700 (Thu, 22 Sep 2011) | 1 line


syntax error crashing php

................

r12655 | p_lindheimer | 2011-09-22 13:22:31 -0700 (Thu, 22 Sep 2011) | 1 line


wrong class name freepbx_conf

................

r12657 | p_lindheimer | 2011-09-22 13:35:46 -0700 (Thu, 22 Sep 2011) | 1 line


tweaks to footer

................

r12663 | p_lindheimer | 2011-09-22 16:14:44 -0700 (Thu, 22 Sep 2011) | 1 line


remove md5sum to re-generate beta1

................

r12664 | p_lindheimer | 2011-09-22 16:15:25 -0700 (Thu, 22 Sep 2011) | 1 line


Creating release 2.10.0beta1

................

r12666 | p_lindheimer | 2011-09-22 16:17:32 -0700 (Thu, 22 Sep 2011) | 1 line


oops remove md5sum again

................

r12668 | p_lindheimer | 2011-09-22 16:18:42 -0700 (Thu, 22 Sep 2011) | 1 line


Creating release 2.10.0beta1

................

r12681 | p_lindheimer | 2011-09-22 16:23:19 -0700 (Thu, 22 Sep 2011) | 1 line


change packed library name checkin in build script

................

r12686 | GameGamer?43 | 2011-09-23 15:24:38 -0700 (Fri, 23 Sep 2011) | 1 line


fixes issue with sponsor_logo height being too big, and should center the footer content

................

r12687 | GameGamer?43 | 2011-09-23 16:33:55 -0700 (Fri, 23 Sep 2011) | 1 line


closes #5375 - set the correct default values on new install

................

r12688 | mbrevda | 2011-09-24 16:39:11 -0700 (Sat, 24 Sep 2011) | 1 line


re #5377 - partial fix for issue mentioned (or maybe just alluded to)

................

r12689 | mbrevda | 2011-09-24 16:41:23 -0700 (Sat, 24 Sep 2011) | 1 line


revert accidental checkin re #5377/r12688

................

r12696 | mbrevda | 2011-09-25 04:14:22 -0700 (Sun, 25 Sep 2011) | 1 line


while trying to fix the languagestatus module I ended up refactoring some of the i18n scripts, which in turn rebuilt/updated all the translation files. If I broke anything or otherwise did soemthing stupid, feel free to revert the entire checkin and ill try again

................

r12713 | mbrevda | 2011-09-26 09:25:17 -0700 (Mon, 26 Sep 2011) | 1 line


re #5341 - more gui tweaks and growing pains

................

r12714 | mbrevda | 2011-09-26 09:45:17 -0700 (Mon, 26 Sep 2011) | 1 line


re #5342 - more changes

................

r12716 | mbrevda | 2011-09-27 09:33:39 -0700 (Tue, 27 Sep 2011) | 1 line


re #5342 - more gui tweaks

................

r12717 | mickecarlsson | 2011-09-28 13:29:48 -0700 (Wed, 28 Sep 2011) | 1 line


Closes #5375, add support in ARI for Urgent Voicemail folder

................

r12718 | p_lindheimer | 2011-09-30 18:38:12 -0700 (Fri, 30 Sep 2011) | 1 line


returns ability to change menu items from freepbx_menu.conf as well as honor sort orders

................

r12719 | mickecarlsson | 2011-10-01 13:12:55 -0700 (Sat, 01 Oct 2011) | 1 line


fix for r12718

................

r12720 | mickecarlsson | 2011-10-02 02:21:00 -0700 (Sun, 02 Oct 2011) | 1 line


Re #5390, small fix for footer to localize

................

r12726 | mbrevda | 2011-10-03 06:40:00 -0700 (Mon, 03 Oct 2011) | 1 line


undefined variables

................

r12727 | p_lindheimer | 2011-10-03 10:39:18 -0700 (Mon, 03 Oct 2011) | 1 line


fixes recent changes when no freepbx_menu.conf file present

................

r12728 | p_lindheimer | 2011-10-03 16:07:37 -0700 (Mon, 03 Oct 2011) | 1 line


allows menu tabs with only a single module to be a direct link, removes User Panel link which will be replaced by a module

................

r12730 | p_lindheimer | 2011-10-03 16:18:33 -0700 (Mon, 03 Oct 2011) | 1 line


undefined indices and typo

................

r12731 | mbrevda | 2011-10-04 02:27:03 -0700 (Tue, 04 Oct 2011) | 1 line


re #5342 - flyout menues on hover

................

r12732 | mbrevda | 2011-10-04 03:07:28 -0700 (Tue, 04 Oct 2011) | 1 line


re #5342 - firefox doesnt support window.location.origin

................

r12757 | p_lindheimer | 2011-10-04 18:41:44 -0700 (Tue, 04 Oct 2011) | 1 line


adds notice for browser stats collection, adds setting for freepbx_menu.conf, move several new settings to propeper location

................

r12764 | p_lindheimer | 2011-10-05 11:28:16 -0700 (Wed, 05 Oct 2011) | 1 line


rename 2.10alpha1 properly

................

r12765 | p_lindheimer | 2011-10-05 11:28:43 -0700 (Wed, 05 Oct 2011) | 1 line


oops and remove the 2.10alpha1

................

r12774 | p_lindheimer | 2011-10-06 08:59:14 -0700 (Thu, 06 Oct 2011) | 1 line


keep favorites on left

................

r12776 | p_lindheimer | 2011-10-06 09:35:24 -0700 (Thu, 06 Oct 2011) | 1 line


fix module_name not being resolved

................

r12777 | p_lindheimer | 2011-10-06 13:12:59 -0700 (Thu, 06 Oct 2011) | 1 line


adds USE_GOOGLE_CDN_JS Advanced Setting to choose between local system only and CDN option

................

r12802 | p_lindheimer | 2011-10-14 13:59:32 -0700 (Fri, 14 Oct 2011) | 1 line


remove FOP from framework and convert to real module

................

r12803 | p_lindheimer | 2011-10-14 14:07:30 -0700 (Fri, 14 Oct 2011) | 1 line


removing more FOP hardcoded stuff in install_amp

................

r12804 | p_lindheimer | 2011-10-14 14:14:01 -0700 (Fri, 14 Oct 2011) | 1 line


oops removed one too many lines dumping FOP stuff

................

r12805 | p_lindheimer | 2011-10-16 16:00:24 -0700 (Sun, 16 Oct 2011) | 1 line


remove some debuging statements left over

................

r12808 | p_lindheimer | 2011-10-17 10:15:04 -0700 (Mon, 17 Oct 2011) | 1 line


reset hidden setting in defines that were moved from incorrect upgrade script

................

r12809 | p_lindheimer | 2011-10-17 10:33:18 -0700 (Mon, 17 Oct 2011) | 1 line


remove some additional FOP code since making a module

................

r12810 | p_lindheimer | 2011-10-17 10:34:51 -0700 (Mon, 17 Oct 2011) | 1 line


more FOP code in framework that probably shouldn't be here

................

r12811 | p_lindheimer | 2011-10-17 10:36:20 -0700 (Mon, 17 Oct 2011) | 1 line


freepbx_settings should NOT be initialized in the DB, every install/upgrade of FreePBX sets them or module specific locations set them

................

r12812 | p_lindheimer | 2011-10-17 10:38:03 -0700 (Mon, 17 Oct 2011) | 1 line


more FOP stuff that should not be in framework

................

r12816 | p_lindheimer | 2011-10-17 16:20:54 -0700 (Mon, 17 Oct 2011) | 1 line


add hook to freepbx_engine (amportal) so modules can hook into start/stop asterisk and add commands

................

r12817 | p_lindheimer | 2011-10-17 17:22:49 -0700 (Mon, 17 Oct 2011) | 1 line


don't special case fw_fop anymore

................

r12818 | p_lindheimer | 2011-10-17 17:27:51 -0700 (Mon, 17 Oct 2011) | 1 line


add hook to provide additional help about new commands that may be added

................

r12820 | p_lindheimer | 2011-10-17 17:37:36 -0700 (Mon, 17 Oct 2011) | 1 line


remove the stop/stop/restart of fop deprecation messages, module adds those back in and these interfere

................

r12823 | p_lindheimer | 2011-10-18 09:31:31 -0700 (Tue, 18 Oct 2011) | 1 line


don't serve pbxlib.js as 'php' executed code to compress as this makes it dynamic and never gets the affect of caching, compression can be turned on in apache and will address other files as well.

................

r12824 | p_lindheimer | 2011-10-18 09:58:03 -0700 (Tue, 18 Oct 2011) | 1 line


make mstyle_css_generated a normal CSS file as compression in php with .php extensions keeps it from being cached, this can be done by apache

................

r12825 | GameGamer?43 | 2011-10-18 14:28:22 -0700 (Tue, 18 Oct 2011) | 1 line


suppress error msgs if there are no engine hooks

................

r12827 | p_lindheimer | 2011-10-18 15:36:53 -0700 (Tue, 18 Oct 2011) | 1 line


turn off ob_gzhandler as this is better done in apache and will otherwise conflict with apache, beta2 migration will set existing systems to blank, left in as hidden readonly though as there are still uses for this including debugging situations with custom callbacks or where it is prefered to gzip in freepbx and not apache

................

r12836 | p_lindheimer | 2011-10-19 09:47:47 -0700 (Wed, 19 Oct 2011) | 1 line


create beta2 migration and directory

................

r12837 | p_lindheimer | 2011-10-19 10:02:04 -0700 (Wed, 19 Oct 2011) | 1 line


freepbx_conf not always set so can't accesss as global

................

r12838 | p_lindheimer | 2011-10-19 10:36:45 -0700 (Wed, 19 Oct 2011) | 1 line


migration should remove links as well if installed with --dev-links

................

r12841 | p_lindheimer | 2011-10-19 13:09:33 -0700 (Wed, 19 Oct 2011) | 1 line


make sure FOPPASSWORD is not hidden or it won't be put in the auto-generated amportal.conf file that FOP still uses

................

r12842 | p_lindheimer | 2011-10-19 13:12:46 -0700 (Wed, 19 Oct 2011) | 1 line


make sure pack_javascripts.php does not include pbxlib.js

................

r12845 | p_lindheimer | 2011-10-19 15:53:17 -0700 (Wed, 19 Oct 2011) | 1 line


remove buffering_callback setting, making it blank results in errors and since we will be doing this in apache it is no longer needed

................

r12861 | p_lindheimer | 2011-10-20 10:28:32 -0700 (Thu, 20 Oct 2011) | 1 line


syntax error results in crashing on 2.9 to 2.10 upgrades

................

r12873 | p_lindheimer | 2011-10-20 12:19:58 -0700 (Thu, 20 Oct 2011) | 1 line


can't remove a directory in this migration loop, being handled in beta2 migration

................

r12879 | GameGamer?43 | 2011-10-21 09:09:44 -0700 (Fri, 21 Oct 2011) | 1 line


allow phpcomponent to contain or statements (

)

................

r12882 | p_lindheimer | 2011-10-21 09:27:45 -0700 (Fri, 21 Oct 2011) | 1 line


Creating release 2.10.0beta2

................

r12902 | p_lindheimer | 2011-11-01 12:12:12 -0700 (Tue, 01 Nov 2011) | 1 line


broken probably in error when cleaing up spaces/tabs in r12651

................

r12916 | p_lindheimer | 2011-11-04 09:34:54 -0700 (Fri, 04 Nov 2011) | 1 line


remove md5 sum in preparation for re-doing beta2 tag

................

r12918 | p_lindheimer | 2011-11-04 09:36:15 -0700 (Fri, 04 Nov 2011) | 1 line


Creating release 2.10.0beta2

................

r12931 | p_lindheimer | 2011-11-04 09:39:09 -0700 (Fri, 04 Nov 2011) | 1 line


no more htdocs_panel in md5

................

r12932 | p_lindheimer | 2011-11-06 11:27:52 -0800 (Sun, 06 Nov 2011) | 1 line


fixes #5122 don't mkdir if it's already there so an eroneous error does not get reported

................

r12941 | mbrevda | 2011-11-09 10:27:04 -0800 (Wed, 09 Nov 2011) | 1 line


re #5443 - paging improvements, revert some accidental checkins

................

r12949 | p_lindheimer | 2011-11-12 09:50:10 -0800 (Sat, 12 Nov 2011) | 1 line


undefined variables

................

r12950 | p_lindheimer | 2011-11-12 09:50:50 -0800 (Sat, 12 Nov 2011) | 1 line


allow more than 10 subdirectories, new structure can have 31 for a given month

................

r12951 | p_lindheimer | 2011-11-12 09:51:48 -0800 (Sat, 12 Nov 2011) | 1 line


undefined variables

................

r12952 | p_lindheimer | 2011-11-12 09:52:42 -0800 (Sat, 12 Nov 2011) | 1 line


undefined variables and remove legacy call recording controls, does NOT add new controls, currently only available in freepbx extension page

................

r12953 | p_lindheimer | 2011-11-12 09:57:56 -0800 (Sat, 12 Nov 2011) | 1 line


cache recording files directory search for legacy files, check only if CDR field check is unsuccessfull, remove context column, undefined vars

................

r12957 | GameGamer?43 | 2011-11-14 09:04:46 -0800 (Mon, 14 Nov 2011) | 1 line


should be require_once for cronmanager

................

r12962 | mbrevda | 2011-11-15 05:09:07 -0800 (Tue, 15 Nov 2011) | 1 line


re #5451 - abstract app_meetme to transparently support app_meetme OR app_confbridge

................

r12963 | GameGamer?43 | 2011-11-15 08:30:11 -0800 (Tue, 15 Nov 2011) | 1 line


re #5450 - fixing typo, thanks andyoutside

................

r12964 | mbrevda | 2011-11-16 02:34:57 -0800 (Wed, 16 Nov 2011) | 1 line


downstream changes to allow click events in menu items (i.e. codes in sip/iax settings)

................

r12968 | mbrevda | 2011-11-21 10:38:57 -0800 (Mon, 21 Nov 2011) | 1 line


upstream changes. Thanks Schmoozecom.com!

................

r12970 | GameGamer?43 | 2011-11-23 13:12:57 -0800 (Wed, 23 Nov 2011) | 1 line


attempt to get and set the timezone

................

r12973 | GameGamer?43 | 2011-11-23 14:46:27 -0800 (Wed, 23 Nov 2011) | 1 line


fixing beta2.4 that was just rolled, so we can roll a beta2.5

................

r12976 | mbrevda | 2011-11-28 11:15:38 -0800 (Mon, 28 Nov 2011) | 1 line


Upstream Changes: add support for global ajax spinner, allow multipal identical keys to be sent to manager

................

r12978 | mbrevda | 2011-11-28 11:36:57 -0800 (Mon, 28 Nov 2011) | 1 line


re #5342. Thanks Schmooze Com!

................

r12983 | p_lindheimer | 2011-11-30 16:54:50 -0800 (Wed, 30 Nov 2011) | 1 line


auto-detect or correct ASTCONFAPP and notify if changes are made

................

r12986 | p_lindheimer | 2011-12-04 13:19:52 -0800 (Sun, 04 Dec 2011) | 1 line


make default and app_meetme the same to handle possible migration issues of ASTCONFAPP not being set yet

................

r12987 | p_lindheimer | 2011-12-04 13:27:54 -0800 (Sun, 04 Dec 2011) | 1 line


don't need to pass MODULE_REPO to functions as it is the default

................

r12988 | p_lindheimer | 2011-12-04 14:19:13 -0800 (Sun, 04 Dec 2011) | 1 line


buffering_callback has been removed from FreePBX, these should not be re-introduced

................

r12989 | p_lindheimer | 2011-12-04 17:16:14 -0800 (Sun, 04 Dec 2011) | 1 line


module_getonlinexml() defaults to MODULE_REPO so no need to pass it in here

................

r12990 | p_lindheimer | 2011-12-04 17:19:09 -0800 (Sun, 04 Dec 2011) | 1 line


closes #5461 allow failover repo to be configured in freepbx, will update settings when infrastructure is in place for additional repos

................

r12992 | mbrevda | 2011-12-05 01:06:01 -0800 (Mon, 05 Dec 2011) | 1 line


upstream changes

................

r12993 | mbrevda | 2011-12-05 11:32:06 -0800 (Mon, 05 Dec 2011) | 1 line


upstream changes

................

r12994 | p_lindheimer | 2011-12-05 16:37:04 -0800 (Mon, 05 Dec 2011) | 1 line


use ASTLOGDIR to set path

................

r12995 | p_lindheimer | 2011-12-06 20:34:29 -0800 (Tue, 06 Dec 2011) | 1 line


closes #5463 adds modgettext class and replaces all the repeated loops throughout the code with the use of this static class

................

r12996 | p_lindheimer | 2011-12-07 08:30:48 -0800 (Wed, 07 Dec 2011) | 1 line


fixes #5442 allows install_amp to accept Asterisk 10

................

r13047 | p_lindheimer | 2011-12-07 15:40:59 -0800 (Wed, 07 Dec 2011) | 1 line


should be pbxlib.js from previous changes

................

r13048 | p_lindheimer | 2011-12-07 16:11:25 -0800 (Wed, 07 Dec 2011) | 1 line


don't use FILE to get dirname as it can do weird things whith symlinks resulting in trying to include the same file twice even with include_once/require_once directives

................

r13050 | p_lindheimer | 2011-12-08 09:49:41 -0800 (Thu, 08 Dec 2011) | 1 line


fixes #5465 reverts r13048

................

r13053 | p_lindheimer | 2011-12-08 15:42:51 -0800 (Thu, 08 Dec 2011) | 1 line


check if the setting exists first, this will have to be added to beta3/rc1 whichever comes next for existinginstalls to run, should not add such things to migrations scripts for releases that are already out

................

r13054 | p_lindheimer | 2011-12-09 08:18:20 -0800 (Fri, 09 Dec 2011) | 1 line


add some logging, add set-freepbx-settings option (experimental untested), make parser force booleans

................

r13065 | p_lindheimer | 2011-12-12 09:09:27 -0800 (Mon, 12 Dec 2011) | 1 line


undefine index check

................

r13071 | p_lindheimer | 2011-12-13 09:03:10 -0800 (Tue, 13 Dec 2011) | 1 line


make copy of amp_conf before initializing freepbx_conf class or configured settings will get blown away

................

r13072 | p_lindheimer | 2011-12-13 09:13:41 -0800 (Tue, 13 Dec 2011) | 1 line


add more verbose logging so we get more details of what it did in install log files

................

r13073 | GameGamer?43 | 2011-12-14 12:59:03 -0800 (Wed, 14 Dec 2011) | 1 line


use the global amp_conf var otherwise we end up calling /freepbx_engine

................

r13075 | p_lindheimer | 2011-12-15 16:41:42 -0800 (Thu, 15 Dec 2011) | 1 line


fixes #5475 force fpbx_framework_autoloader(true) if a module says it needs Zend

................

r13076 | p_lindheimer | 2011-12-15 16:43:10 -0800 (Thu, 15 Dec 2011) | 1 line


re #5475 initialize force_autoload

................

r13078 | p_lindheimer | 2011-12-16 12:41:06 -0800 (Fri, 16 Dec 2011) | 1 line


bootstrap already includes these modules don't include them again

................

r13079 | p_lindheimer | 2011-12-16 12:45:20 -0800 (Fri, 16 Dec 2011) | 1 line


remove some debug statements

................

r13081 | p_lindheimer | 2011-12-16 19:20:02 -0800 (Fri, 16 Dec 2011) | 1 line


this is for freepbx_engine and amportal which must be root to run

................

r13083 | p_lindheimer | 2011-12-16 19:30:34 -0800 (Fri, 16 Dec 2011) | 1 line


always use freepbx.conf to bootstrap and make more file name paths relative to amp_conf vars and not FILE

................

r13084 | p_lindheimer | 2011-12-16 20:39:02 -0800 (Fri, 16 Dec 2011) | 1 line


fixed #5476 adds set_global method and uses throughout

................

r13086 | p_lindheimer | 2011-12-17 08:50:27 -0800 (Sat, 17 Dec 2011) | 1 line


add multiple repos, migration still needed, also clarify upgrade msg that gets people confused in framework module

................

r13087 | p_lindheimer | 2011-12-17 08:54:37 -0800 (Sat, 17 Dec 2011) | 1 line


looks like 1.6.0 is still core set global, now we just need confirmation about 1.6.1...

................

r13097 | p_lindheimer | 2011-12-20 15:09:30 -0800 (Tue, 20 Dec 2011) | 1 line


allow '.php' files through handler

................

r13098 | p_lindheimer | 2011-12-20 15:13:49 -0800 (Tue, 20 Dec 2011) | 1 line


don't force ampuser class to be loaded as it never is with the autoloader and this can result in errors when running in dev mode with symlinks

................

r13099 | p_lindheimer | 2011-12-20 15:16:48 -0800 (Tue, 20 Dec 2011) | 1 line


adds .htaccess for admin and recordings directory which can be optionally used or incorporated into apache configs that can provide protection against possbily undiscovered threats by restricting access to all files that should not be accessible.

................

r13100 | p_lindheimer | 2011-12-20 15:22:41 -0800 (Tue, 20 Dec 2011) | 1 line


not needed anymore for FOP

................

r13110 | mbrevda | 2011-12-21 06:18:11 -0800 (Wed, 21 Dec 2011) | 1 line


dont load modules unless were properly authenticated

................

r13119 | mbrevda | 2011-12-26 04:12:29 -0800 (Mon, 26 Dec 2011) | 1 line


upstream updates

................

r13124 | mbrevda | 2011-12-27 12:08:42 -0800 (Tue, 27 Dec 2011) | 1 line


browsers are good at handeling downloads - let them do so

................

r13125 | mbrevda | 2011-12-28 04:53:37 -0800 (Wed, 28 Dec 2011) | 1 line


fix dbug log file location

................

r13127 | p_lindheimer | 2011-12-28 09:42:10 -0800 (Wed, 28 Dec 2011) | 1 line


tweak to allow /admin and /recordings without trailing / and remove Order since at least one corner case did not like it even though the syntax appears correct

................

r13128 | p_lindheimer | 2011-12-28 12:36:00 -0800 (Wed, 28 Dec 2011) | 1 line


adds mod_exists method

................

r13129 | p_lindheimer | 2011-12-28 12:40:40 -0800 (Wed, 28 Dec 2011) | 1 line


change name to mod_loaded

................

r13130 | p_lindheimer | 2011-12-28 12:47:05 -0800 (Wed, 28 Dec 2011) | 1 line


don't set zap to dadhi compat mode UNLESS it is set in Advanced Settings, probably need to look at removing this all together soon

................

r13131 | p_lindheimer | 2011-12-28 13:24:45 -0800 (Wed, 28 Dec 2011) | 1 line


only include if the class isn't there since include_once can include it a second time in certain symlink situations

................

r13132 | p_lindheimer | 2011-12-28 13:38:26 -0800 (Wed, 28 Dec 2011) | 1 line


create beta3 dir to bump version

................

r13133 | p_lindheimer | 2011-12-28 13:41:43 -0800 (Wed, 28 Dec 2011) | 1 line


don't need notification class

................

r13142 | p_lindheimer | 2011-12-29 15:55:16 -0800 (Thu, 29 Dec 2011) | 1 line


remove some dbug statements

................

r13150 | p_lindheimer | 2011-12-30 15:11:04 -0800 (Fri, 30 Dec 2011) | 1 line


adds migration for recordingfile field in cdr table

................

r13153 | p_lindheimer | 2011-12-30 15:19:23 -0800 (Fri, 30 Dec 2011) | 1 line


adds did and recordingfile to default template

................

r13154 | p_lindheimer | 2011-12-30 15:24:23 -0800 (Fri, 30 Dec 2011) | 1 line


adds migration for did field in cdr table and removed some stupid stuff

................

r13158 | GameGamer?43 | 2012-01-02 12:17:40 -0800 (Mon, 02 Jan 2012) | 1 line


fix for navbar issue, were you would only get half of the navigation menu on a page load

................

r13159 | mbrevda | 2012-01-04 07:18:17 -0800 (Wed, 04 Jan 2012) | 1 line


upstream changes (ready framework to move css compression)

................

r13167 | p_lindheimer | 2012-01-06 11:07:59 -0800 (Fri, 06 Jan 2012) | 1 line


make sure we successfully connected to the CDR DB before trying to add the fields

................

r13190 | p_lindheimer | 2012-01-12 14:13:45 -0800 (Thu, 12 Jan 2012) | 1 line


closes #5513 always act in ZAP2DAHDICOMPAT mode with versions of Asteris that couldn't have zap, we need to remove zap from freepbx in the next major release

................

r13193 | GameGamer?43 | 2012-01-13 12:02:15 -0800 (Fri, 13 Jan 2012) | 1 line


fix check for Zend Optimizer or Zend Guard Loader

................

r13194 | p_lindheimer | 2012-01-13 12:10:32 -0800 (Fri, 13 Jan 2012) | 1 line


syntax error

................

r13197 | p_lindheimer | 2012-01-13 12:19:00 -0800 (Fri, 13 Jan 2012) | 1 line


make sure the setting exists though it really should be there

................

r13200 | p_lindheimer | 2012-01-13 12:25:42 -0800 (Fri, 13 Jan 2012) | 1 line


ok found the real error I hope

................

r13205 | GameGamer?43 | 2012-01-16 16:43:28 -0800 (Mon, 16 Jan 2012) | 1 line


fix for spelling errors

................

r13208 | p_lindheimer | 2012-01-17 12:22:36 -0800 (Tue, 17 Jan 2012) | 1 line


adds rc1 migraton library

................

r13209 | p_lindheimer | 2012-01-17 12:23:50 -0800 (Tue, 17 Jan 2012) | 1 line


cdr dir no longer exists

................

r13210 | p_lindheimer | 2012-01-17 12:26:51 -0800 (Tue, 17 Jan 2012) | 9 lines


Merged revisions 13207 via svnmerge from
http://www.freepbx.org/v2/svn/freepbx/branches/2.9


........

r13207 | p_lindheimer | 2012-01-17 12:21:43 -0800 (Tue, 17 Jan 2012) | 1 line


fix typo disabling the ability to check for the commercial repo

........

................

r13232 | p_lindheimer | 2012-01-17 20:48:27 -0800 (Tue, 17 Jan 2012) | 1 line


Creating release 2.10.0rc1

................

r13245 | GameGamer?43 | 2012-01-20 11:38:13 -0800 (Fri, 20 Jan 2012) | 1 line


set our default language if the cookie has the a blank value

................

r13246 | GameGamer?43 | 2012-01-20 13:23:08 -0800 (Fri, 20 Jan 2012) | 1 line


default our language if we dont have one

................

r13247 | mbrevda | 2012-01-22 04:44:23 -0800 (Sun, 22 Jan 2012) | 1 line


fix some hebrew translation, make paging a destination, remove test code from login.php, offer less privlaged browsers a better experience, update module publishers

................

r13259 | GameGamer?43 | 2012-01-26 08:57:06 -0800 (Thu, 26 Jan 2012) | 1 line


$AMPWEBROOT/_asterisk is removed in 2.10, so dont try to change user and group

................

r13260 | GameGamer?43 | 2012-01-26 17:12:08 -0800 (Thu, 26 Jan 2012) | 1 line


closes #5545 - move css from page load to retrieve_conf

................

r13263 | mbrevda | 2012-01-29 02:56:21 -0800 (Sun, 29 Jan 2012) | 1 line


upstream changes

................

r13391 | mbrevda | 2012-02-02 08:03:59 -0800 (Thu, 02 Feb 2012) | 1 line


re #4909 - reuse cdrdb object. Thanks jdccdevel. Please test this and report back!

................

r13392 | mbrevda | 2012-02-02 08:22:39 -0800 (Thu, 02 Feb 2012) | 1 line


re #4909 - reuse cdrdb object, take two. Thanks jdccdevel. Please test this and report back!

................

r13393 | mbrevda | 2012-02-02 08:59:38 -0800 (Thu, 02 Feb 2012) | 1 line


re #4909 - reuse cdrdb object, take three - nothing should have been changed in bootstrap.php, all changes should be in common.php. Thanks jdccdevel. Please test this and report back!

................

r13396 | p_lindheimer | 2012-02-03 11:46:54 -0800 (Fri, 03 Feb 2012) | 1 line


remove sort order for module admin to keep menus alphabetic

................

r13399 | p_lindheimer | 2012-02-06 13:17:59 -0800 (Mon, 06 Feb 2012) | 1 line


closes #5117 adds fpbx_ami_update that expects to either have an active ami socket open or if none will go through the command line, update manager.conf to the passed in creds and force the manager to reload

................

r13400 | p_lindheimer | 2012-02-07 10:43:15 -0800 (Tue, 07 Feb 2012) | 1 line


update tooltip now that manager.conf is edited re #5117

................

r13405 | p_lindheimer | 2012-02-09 08:03:28 -0800 (Thu, 09 Feb 2012) | 1 line


try to set php session directory for CentOS, not really a FreePBX bug but we try to deal with it if possible re #5540 and various other tickets

................

r13406 | GameGamer?43 | 2012-02-09 10:15:16 -0800 (Thu, 09 Feb 2012) | 1 line


closes #5565 - adds missing param to originate, thanks asternic

................

r13433 | p_lindheimer | 2012-02-13 12:04:05 -0800 (Mon, 13 Feb 2012) | 1 line


reverts r13391, r13392 and r13393 re #4909 which breaks ARI per multiple reports. Also tested the patch as provided after reverting these and it still failed. Once this is reviewed and we can determine a proper patch we can revisit this.

................

r13438 | p_lindheimer | 2012-02-13 18:02:35 -0800 (Mon, 13 Feb 2012) | 1 line


remove debug statements

................

r13443 | mbrevda | 2012-02-16 08:55:32 -0800 (Thu, 16 Feb 2012) | 1 line


provide richest posible experince by prompting user to activate chrome frame

................

r13453 | p_lindheimer | 2012-02-16 13:00:32 -0800 (Thu, 16 Feb 2012) | 1 line


fixes #5528 allow some additional file types needed by FOP

................

r13459 | p_lindheimer | 2012-02-16 19:33:53 -0800 (Thu, 16 Feb 2012) | 1 line


fixes #5391 don't remove publisher we use it

................

r13477 | p_lindheimer | 2012-02-19 08:12:44 -0800 (Sun, 19 Feb 2012) | 1 line


closes #5260 adds SendDTMF to extensions class

................

r13481 | mbrevda | 2012-02-20 04:01:29 -0800 (Mon, 20 Feb 2012) | 1 line


upstream changes, make colapsible gui eleent section actually work

................

r13483 | mbrevda | 2012-02-20 04:08:09 -0800 (Mon, 20 Feb 2012) | 1 line


once is enough

................

r13491 | p_lindheimer | 2012-02-20 16:27:28 -0800 (Mon, 20 Feb 2012) | 1 line


closes #5148 mods to handle 1.8 core stop gracefully synchronous command, tested and seems ok

................

r13540 | mbrevda | 2012-02-21 08:56:50 -0800 (Tue, 21 Feb 2012) | 1 line


ssh keys needs to be 0600 or less or ssh will reject them

................

r13560 | mbrevda | 2012-02-23 05:11:51 -0800 (Thu, 23 Feb 2012) | 1 line


closes #5615, better handeling of undefined options in the cron manager

................

r13561 | mbrevda | 2012-02-23 05:28:27 -0800 (Thu, 23 Feb 2012) | 1 line


clean up stale compressed css

................

r13564 | mbrevda | 2012-02-23 06:09:32 -0800 (Thu, 23 Feb 2012) | 1 line


chown /etc/dahdi & /etc/wanpipe. Hopefull this can be moved to a module some day when there is a proper module

................

r13570 | p_lindheimer | 2012-02-23 12:16:57 -0800 (Thu, 23 Feb 2012) | 1 line


closes #5619 adds option to passthru from db on freepbx_settings, mainly for backup/restore functions

................

r13579 | GameGamer?43 | 2012-02-23 18:11:03 -0800 (Thu, 23 Feb 2012) | 1 line


should be using chmod not chown here

................

r13580 | GameGamer?43 | 2012-02-23 18:21:17 -0800 (Thu, 23 Feb 2012) | 1 line


also only change permissions on id_rsa, if the file exists

................

r13584 | p_lindheimer | 2012-02-23 20:55:32 -0800 (Thu, 23 Feb 2012) | 1 line


make sure the /var/www/html directory is owned by asterisk since yum updates can break that

................

r13587 | p_lindheimer | 2012-02-24 06:56:43 -0800 (Fri, 24 Feb 2012) | 1 line


oops type got wrong variable some how shoudl be PRE_RELOAD

................

r13591 | p_lindheimer | 2012-02-24 07:03:39 -0800 (Fri, 24 Feb 2012) | 1 line


oops and another typo re #5619

................

r13594 | p_lindheimer | 2012-02-24 08:03:27 -0800 (Fri, 24 Feb 2012) | 1 line


chown any top level files in the html directory as well

................

r13598 | p_lindheimer | 2012-02-24 17:06:53 -0800 (Fri, 24 Feb 2012) | 1 line


comment out settings allowing them to be set in the GUI re #5627

................

r13604 | p_lindheimer | 2012-02-27 16:23:12 -0800 (Mon, 27 Feb 2012) | 1 line


fixes #5628 we think don't mutilate channel variables passed in

................

r13623 | p_lindheimer | 2012-02-28 14:12:16 -0800 (Tue, 28 Feb 2012) | 1 line


modify tooltip as to experimental nature of app_confbridge

................

r13624 | p_lindheimer | 2012-02-29 08:49:50 -0800 (Wed, 29 Feb 2012) | 1 line


bump 2.10 final

................

r13634 | p_lindheimer | 2012-02-29 08:57:42 -0800 (Wed, 29 Feb 2012) | 1 line


Auto checkin packed libfreepbx.javascripts.js as part of build process

................

r13635 | p_lindheimer | 2012-02-29 08:57:46 -0800 (Wed, 29 Feb 2012) | 1 line


Creating release 2.10.0

................

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/php -q
2 <?php
3
4 //include bootstrapper
5 $bootstrap_settings['freepbx_auth'] = false;
6 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
7   include_once('/etc/asterisk/freepbx.conf');
8 }
9
10 if (!$bootstrap_settings['astman_connected']) {
11   fatal(sprintf(_("Unable to connect to Asterisk Manager from %s, aborting"),__FILE__));
12 }
13
14 $freepbx_conf =& freepbx_conf::create();
15
16 class connectdirs {
17
18   var $nt;
19   var $symlink_dirs;
20   var $cp_dirs;
21
22   var $cp_errors = '';
23   var $symlink_error_modules = '';
24     
25   function &create() {
26     static $obj;
27     if (!isset($obj)) {
28       $obj = new connectdirs();
29     }
30     return $obj;
31   }
32
33   function connectdirs() {
34     global $amp_conf;
35     global $db;
36     $this->symlink_dirs['bin']        = $amp_conf['AMPBIN'];
37     $this->symlink_dirs['etc']        = $amp_conf['ASTETCDIR'];
38     $this->symlink_dirs['images']     = $amp_conf['AMPWEBROOT'] . "/admin/images";
39     $this->symlink_dirs['ari/modules']  = $amp_conf['AMPWEBROOT'] . "/recordings/modules";
40     $this->symlink_dirs['ari/theme']  = $amp_conf['AMPWEBROOT'] . "/recordings/theme";
41     $this->symlink_dirs['ari/js']   = $amp_conf['AMPWEBROOT'] . "/recordings/theme/js";
42     $this->symlink_dirs['ari/images'] = $amp_conf['AMPWEBROOT'] . "/recordings/theme/images";
43
44     $this->symlink_sound_dirs['sounds']     = $amp_conf['ASTVARLIBDIR'] . '/sounds';
45
46     $this->cp_dirs['agi-bin']       = $amp_conf['ASTAGIDIR'];
47
48     $this->nt = notifications::create($db);
49   }
50
51   function symlink_assets($module) {
52     global $amp_conf;
53
54     // e.g. /var/www/html/admin/modules/ringgroups/assets
55     // e.g. /var/www/html/admin/assets/ringgroups
56     //
57     $dir = $amp_conf['AMPWEBROOT'] . '/admin/modules/' . $module . '/assets';
58     $targetdir = $amp_conf['AMPWEBROOT'] . "/admin/assets/" . $module;
59
60     // if assets does not exists in the module then unlinkk it in assets had it
61     // been there already.
62     //
63     if (!is_dir($dir)) {
64       if (is_link($targetdir)) {
65         $this->err_unlink($targetdir);
66       }
67       return;
68     } elseif (!is_link($targetdir)) {
69       // The assets dir exists in the module but no symlink to it, so do that now
70       // e.g. ln -s /var/www/html/admin/modules/ringgroups/assets /var/www/html/admin/assets/ringgroups
71       //
72       if (!symlink($dir, $targetdir)) {
73         freepbx_log(FPBX_LOG_ERROR, "Can Not $dir to $targetdir");
74       }
75
76     }
77   }
78
79   function symlink_sound_dirs($moduledir) {
80     $language_dirs = array();
81     foreach ($this->symlink_sound_dirs as $subdir => $targetdir) {
82       $dir = addslash($moduledir).$subdir;
83       if (is_dir($dir)) {
84         $d = opendir($dir);
85         while ($file = readdir($d)) {
86           if ($file[0] != '.') {
87             // If this is a directory, then put it on the list of language directories to process
88             // otherwise symlink it
89             //
90             if (is_dir(addslash($dir).$file)) {
91               $language_dirs[] = $file;
92             } else {
93               $this->do_symlink(addslash($dir).$file, addslash($targetdir).$file, $subdir, $moduledir);
94             }
95           }
96         }
97         closedir($d);
98         // Now if we have any langauge directories, then check if they are installed on the target and
99         // if so symlink them over.
100         foreach ($language_dirs as $lang) {
101           if (is_dir(addslash($targetdir).$lang)) {
102             $d = opendir(addslash($dir).$lang);
103             while ($file = readdir($d)) {
104               if ($file[0] != '.') {
105                 $this->do_symlink(addslash($dir).addslash($lang).$file, addslash($targetdir).addslash($lang).$file, $subdir, $moduledir);
106               }
107             }
108           } else {
109             out("found language dir $lang for ".basename($moduledir).", not installed on system, skipping");
110           }
111         }
112       }
113     }
114   }
115
116   function symlink_subdirs($moduledir) {
117     foreach ($this->symlink_dirs as $subdir => $targetdir) {
118       $dir = addslash($moduledir).$subdir;
119       if (is_dir($dir)) {
120         $d = opendir($dir);
121         while ($file = readdir($d)) {
122           if ($file[0] != '.') {
123             $this->do_symlink(addslash($dir).$file, addslash($targetdir).$file, $subdir, $moduledir);
124           }
125         }
126         closedir($d);
127       }
128     }
129   }
130
131   function do_symlink($src, $dest, $subdir, $moduledir) {
132     if (file_exists_wrapper($dest)) {
133       if ((!is_link($dest) || readlink($dest) != $src) && (md5_file($src) == md5_file($dest))) {
134         // dbug('retrieve-conf', "Can't symlink $src to $dest but files are the same so ignoring");
135       } else if (!is_link($dest)) {
136         freepbx_log(FPBX_LOG_ERROR, $dest.' already exists, and is not a symlink!');
137         $this->symlink_error_modules .= "<br />&nbsp;&nbsp;&nbsp;".$dest." from ".basename($moduledir)."/".$subdir." (Already exists, not a link)";
138       } else if (readlink($dest) != $src) {
139         // TODO : is this the proper handling? should we just overwrite..?
140         freepbx_log(FPBX_LOG_ERROR, $dest.' already exists, and is linked to something else!');
141         $this->symlink_error_modules .= "<br />&nbsp;&nbsp;&nbsp;".$dest." from ".basename($moduledir)."/".$subdir." (Already exists, linked to something else)";
142       }
143     } else {
144 //    // symlink, unlike copy, doesn't overwrite - have to delete first
145 //    if (is_link($dest) || file_exists($dest)) {
146 //      unlink($dest);
147 //    }
148       if (!symlink($src, $dest)) {
149         freepbx_log(FPBX_LOG_ERROR, 'Cannot symlink '.$src.' to '.$dest.'. Check Permissions?');
150       }
151     }
152   }
153
154   function symlink_check_errors() {
155     if ($this->symlink_error_modules) {
156       $this->nt->add_error('retrieve_conf', 'SYMLINK', _("Symlink from modules failed"), sprintf(_("retrieve_conf failed to sym link: %s<br \>This can result in FATAL failures to your PBX. If the target file exists and not identical, the symlink will not occur and you should rename the target file to allow the automatic sym link to occur and remove this error, unless this is an intentional customization."),$this->symlink_error_modules));
157     } else {
158       $this->nt->delete('retrieve_conf', 'SYMLINK');
159     }
160   }
161
162   function cp_subdirs($moduledir) {
163     foreach ($this->cp_dirs as $subdir => $targetdir) {
164       $dir = addslash($moduledir).$subdir;
165       if(is_dir($dir)){
166         foreach(listdir($dir) as $idx => $file){
167           $sourcefile = $file;
168           $filesubdir=str_replace($dir.'/', '', $file);
169           $targetfile = addslash($targetdir).$filesubdir;
170  
171           if (file_exists_wrapper($targetfile)) {
172             if (is_link($targetfile)) {
173               if (!$this->err_unlink($targetfile)) {
174                 freepbx_log(FPBX_LOG_ERROR, "$targetfile is a symblolic link, failed to unlink!");
175                 break;
176               }
177             }
178           }
179           // OK, now either the file is a regular file or isn't there, so proceed
180           //
181           if ($this->err_copy($sourcefile,$targetfile)) {
182             // copy was successful, make sure it has execute permissions
183             chmod($targetfile,0754);
184           } else {
185             freepbx_log(FPBX_LOG_ERROR, "$targetfile failed to copy from module directory");
186           }
187         }
188       }
189     }
190   }
191   function cp_check_errors() {
192     if ($this->cp_errors) {
193       $this->nt->add_error('retrieve_conf', 'CPAGIBIN', _("Failed to copy from module agi-bin"), sprintf(_("Retrieve conf failed to copy file(s) from a module's agi-bin dir: %s"),$this->cp_errors));
194     } else {
195       $this->nt->delete('retrieve_conf', 'CPAGIBIN');
196     }
197   }
198   function add_cp_error($string) {
199     $this->cp_errors .= $string;
200   }
201
202   // wrap copy with error handler
203   //
204   function err_copy($source, $dest) {
205     $ret = false;
206     set_error_handler("report_errors");
207       //if were copying a directory, just mkdir the directory
208     if (!is_link($dest) && !is_dir($dest)) {
209       if(is_dir($source)){
210         $ret = mkdir($dest,0754);
211       }elseif(copy($source, $dest)) {
212         $ret = chmod($dest,0754);
213       }
214     }
215     restore_error_handler();
216     return $ret;
217     }
218
219   // wrap unlink with error handler
220   //
221   function err_unlink($dest) {
222     set_error_handler("report_errors");
223     $ret = unlink($dest);
224     restore_error_handler();
225     return $ret;
226   }
227 }
228
229 // I don't think this can be part of the class since it is called by an
230 // error function as a callback (otherwise, can move it into above).
231 //
232 function report_errors($errno, $errstr, $errfile, $errline) {
233   global $db;
234   $escaped_string = $db->escapeSimple($errstr);
235   freepbx_log(FPBX_LOG_ERROR, "php reported: '$escaped_string' after copy or unlink attempt!");
236   $conn_dirs = connectdirs::create();
237   $conn_dirs->add_cp_error($errstr."\n");
238 }
239
240 //define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf");
241 define("WARNING_BANNER", _(";--------------------------------------------------------------------------------;\n; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;\n; this file must be done via the web gui. There are alternative files to make    ;\n; custom modifications, details at: http://freepbx.org/configuration_files       ;\n;--------------------------------------------------------------------------------;\n;\n\n"));
242
243 function showHelp() {
244   out(_("Optional parameters:"),false);
245   out(_("  --help, -h, -?           Show this help"),false);
246   out(_("  --debug                  Enable debug output"),false);
247   out(_("  --dry-run                Don't actually do anything"),false);
248 }
249
250 /** Adds a trailing slash to a directory, if it doesn't already have one
251  */
252 function addslash($dir) {
253   return (($dir[ strlen($dir)-1 ] == '/') ? $dir : $dir.'/');
254 }
255
256
257 /********************************************************************************************************************/
258
259 $dryrun = false;
260 $run_install = false;
261 $skip_registry_checks = false;
262
263 // **** Make sure we have PEAR's GetOpts.php, and include it if we need to parse
264 //
265 if ($argc > 1) {
266   outn(_("Checking for PEAR Console::Getopt.."));
267   if (! @ include("Console/Getopt.php")) {
268     out(_("FAILED"));
269     fatal(sprintf(_("PEAR must be installed (requires Console/Getopt.php). Include path: %s"), ini_get("include_path")),true);
270   }
271   out(_("OK"));
272
273   // **** Parse out command-line options
274   $shortopts = "h?u:p:";
275   $longopts = array("help","debug","dry-run","run-install","amportalconf=","skip-registry-checks");
276
277   $args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts);
278   if (is_object($args)) {
279     // assume it's PEAR_ERROR
280     out($args->message);
281     exit(255);
282   }
283
284   foreach ($args[0] as $arg) {
285     switch ($arg[0]) {
286       case "--help": case "h": case "?":
287         showHelp();
288         exit(10);
289       break;
290       case "--dry-run":
291         out(_("Dry-run only, no files will be written"),false);
292         $dryrun = true;
293       break;
294       case "--debug":
295         // set to false temporarily, not with freepbx_conf as we don't want it subsequently committed
296         //
297         $amp_conf['FPBXDBUGDISABLE'] = false;
298         debug(_("Debug mode enabled"),false);
299       break;
300       case "--run-install":
301         $run_install = true;
302         out(_("Running module install.php and install.sql scripts"),true);
303       break;
304       case "--amportalconf":
305         $amportalconf = $arg[1];
306         out(sprintf(_("Using %s configuration file"), $amportalconf),false);
307       break;
308       case "--skip-registry-checks":
309         $skip_registry_checks = true;
310         out(_("Skipping extension and destination registry checks"),true);
311       break;
312     }
313   }
314 }
315
316 // Define the notification class for logging to the dashboard
317 //
318 $nt = notifications::create($db);
319 $con_dirs = connectdirs::create();
320
321 /*
322 */
323 // Check and increase php memory_limit if needed and if allowed on the system
324 // TODO: should all be in bootstrap
325 $current_memory_limit = rtrim(ini_get('memory_limit'),'M');
326 $proper_memory_limit = '100';
327 if ($current_memory_limit < $proper_memory_limit) {
328   if (ini_set('memory_limit',$proper_memory_limit.'M') !== false) {
329     $nt->add_notice('core', 'MEMLIMIT', _("Memory Limit Changed"), sprintf(_("Your memory_limit, %sM, is set too low and has been increased to %sM. You may want to change this in you php.ini config file"),$current_memory_limit,$proper_memory_limit));
330   } else {
331     $nt->add_warning('core', 'MEMERR', _("Low Memory Limit"), sprintf(_("Your memory_limit, %sM, is set too low and may cause problems. FreePBX is not able to change this on your system. You should increase this to %sM in you php.ini config file"),$current_memory_limit,$proper_memory_limit));
332   }
333 } else {
334   $nt->delete('core', 'MEMLIMIT');
335 }
336
337
338 //Putting the core module last, to move outbound-allroutes
339 // last in from-internals-additional
340 if (array_key_exists('core', $active_modules)) {
341         $core_tmp = $active_modules['core'];
342         unset($active_modules['core']);
343         $active_modules['core'] = $core_tmp;
344 }
345
346 // include any module global functions
347 // $active_modules is provided by bootstrap now
348 //
349 if(is_array($active_modules)){
350   foreach($active_modules as $key => $module) {
351
352     $module_list[] = $key;
353
354     if ($run_install) module_install($key);
355
356     // create symlinks for files in appropriate sub directories
357     // don't symlink framework files, it is a special case module that happens to have
358     // some conflicting names
359     //
360     switch ($key) {
361       // TODO: these will go away once repositories are up-to-date but leave until 2.10
362       //       at that time the modtype tag will determine this
363       case 'framework':
364       case 'fw_ari':
365       case 'fw_langpacks':
366       break;
367       default:
368         if (isset($module['modtype']) && $module['modtype'] == 'framework') {
369           // don't copy or symlink from framework type modules as they are not real modules
370           break;
371         }
372         $con_dirs->symlink_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key );
373         $con_dirs->symlink_sound_dirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key );
374         $con_dirs->symlink_assets($key);
375         $con_dirs->cp_subdirs( $amp_conf['AMPWEBROOT'].'/admin/modules/'.$key );
376       break;
377     }
378   }
379 }
380
381 // Now that we have done all the symlinks and copies, we check and report if there were any errors
382 //
383 $con_dirs->symlink_check_errors();
384 $con_dirs->cp_check_errors();
385
386 //once we have all the connected files in place, lets compress the css
387 if ($amp_conf['DISABLE_CSS_AUTOGEN'] != true) {
388   compress_framework_css();
389 }
390
391 // create an object of the extensions class
392 require_once($amp_conf['AMPWEBROOT']."/admin/libraries/extensions.class.php");
393 $ext = new extensions;
394
395 if ($amp_conf['DISABLECUSTOMCONTEXTS']) {
396   $ext->disableCustomContexts(true);
397 }
398
399 // create objects for any module classes
400 // currently only 1 class can be declared per module, not sure if that will be an issue
401 if(isset($module_list) && is_array($module_list)){
402   foreach($module_list as $active_module) {
403     $classname = $active_module."_conf";
404     if(class_exists($classname)) {
405       ${$classname} = new $classname;
406     }
407   }
408 }
409
410 $engineinfo = engine_getinfo();
411 if($engineinfo['version'] == 0){
412   fatal(_("retreive_conf failed to get engine information and cannot configure up a softwitch with out it. Error: {$engineinfo['engine']}"),true);
413 }
414 // was setting these variables before, assume we still need them
415 $engine = $engineinfo['engine'];
416 $version = $engineinfo['version'];
417 $chan_dahdi = ast_with_dahdi();
418
419 // If BROWSER_STATS is set to true (default) and we have never provided a notice (NOTICE_BROWSER_STATS false) then do so one time only so
420 // they are aware and can choose to opt out.
421 if (!$amp_conf['NOTICE_BROWSER_STATS'] && $amp_conf['BROWSER_STATS']) {
422   $nt->add_notice('framework', 'BROWSER_STATS', _("Collecting Anonymous Browser Stats"), _("The FreePBX project is collecting anonymous browser statistics using google analytics. These are used to focus development efforts based on real user input. All information is anonymous. You can disable this in Advanced Settings with the Browser Stats setting."));
423   $freepbx_conf->set_conf_values(array('NOTICE_BROWSER_STATS' => true), true, true);
424 }
425
426
427 if (!$freepbx_conf->conf_setting_exists('AST_FUNC_DEVICE_STATE')) {
428   // AST_FUNC_DEVICE_STATE
429   //
430   $set['value'] = '';
431   $set['defaultval'] =& $set['value'];
432   $set['options'] = '';
433   $set['readonly'] = 1;
434   $set['hidden'] = 1;
435   $set['level'] = 10;
436   $set['module'] = '';
437   $set['category'] = 'Internal Use';
438   $set['emptyok'] = 1;
439   $set['name'] = 'Asterisk Function DEVICE_STATE';
440   $set['description'] = "Set to the function name if the function is present in this Asterisk install";
441   $set['type'] = CONF_TYPE_TEXT;
442   $freepbx_conf->define_conf_setting('AST_FUNC_DEVICE_STATE',$set);
443 }
444 if (!$freepbx_conf->conf_setting_exists('AST_FUNC_EXTENSION_STATE')) {
445   // AST_FUNC_EXTENSION_STATE
446   //
447   $set['value'] = '';
448   $set['defaultval'] =& $set['value'];
449   $set['options'] = '';
450   $set['readonly'] = 1;
451   $set['hidden'] = 1;
452   $set['level'] = 10;
453   $set['module'] = '';
454   $set['category'] = 'Internal Use';
455   $set['emptyok'] = 1;
456   $set['name'] = 'Asterisk Function EXTENSION_STATE';
457   $set['description'] = "Set to the function name if the function is present in this Asterisk install";
458   $set['type'] = CONF_TYPE_TEXT;
459   $freepbx_conf->define_conf_setting('AST_FUNC_EXTENSION_STATE',$set);
460 }
461 if (!$freepbx_conf->conf_setting_exists('AST_FUNC_SHARED')) {
462   // AST_FUNC_SHARED
463   //
464   $set['value'] = '';
465   $set['defaultval'] =& $set['value'];
466   $set['options'] = '';
467   $set['readonly'] = 1;
468   $set['hidden'] = 1;
469   $set['level'] = 10;
470   $set['module'] = '';
471   $set['category'] = 'Internal Use';
472   $set['emptyok'] = 1;
473   $set['name'] = 'Asterisk Function SHARED';
474   $set['description'] = "Set to the function name if the function is present in this Asterisk install";
475   $set['type'] = CONF_TYPE_TEXT;
476   $freepbx_conf->define_conf_setting('AST_FUNC_SHARED',$set);
477 }
478 if (!$freepbx_conf->conf_setting_exists('AST_FUNC_CONNECTEDLINE')) {
479   // AST_FUNC_CONNECTEDLINE
480   //
481   $set['value'] = '';
482   $set['defaultval'] =& $set['value'];
483   $set['options'] = '';
484   $set['readonly'] = 1;
485   $set['hidden'] = 1;
486   $set['level'] = 10;
487   $set['module'] = '';
488   $set['category'] = 'Internal Use';
489   $set['emptyok'] = 1;
490   $set['name'] = 'Asterisk Function CONNECTEDLINE';
491   $set['description'] = "Set to the function name if the function is present in this Asterisk install";
492   $set['type'] = CONF_TYPE_TEXT;
493   $freepbx_conf->define_conf_setting('AST_FUNC_CONNECTEDLINE',$set);
494 }
495 if (!$freepbx_conf->conf_setting_exists('AST_FUNC_MASTER_CHANNEL')) {
496   // AST_FUNC_MASTER_CHANNEL
497   //
498   $set['value'] = '';
499   $set['defaultval'] =& $set['value'];
500   $set['options'] = '';
501   $set['readonly'] = 1;
502   $set['hidden'] = 1;
503   $set['level'] = 10;
504   $set['module'] = '';
505   $set['category'] = 'Internal Use';
506   $set['emptyok'] = 1;
507   $set['name'] = 'Asterisk Function MASTER_CHANNEL';
508   $set['description'] = "Set to the function name if the function is present in this Asterisk install";
509   $set['type'] = CONF_TYPE_TEXT;
510   $freepbx_conf->define_conf_setting('AST_FUNC_MASTER_CHANNEL',$set);
511 }
512 if (!$freepbx_conf->conf_setting_exists('AST_APP_VQA')) {
513   // AST_APP_VQA
514   //
515   $set['value'] = '';
516   $set['defaultval'] =& $set['value'];
517   $set['options'] = '';
518   $set['readonly'] = 1;
519   $set['hidden'] = 1;
520   $set['level'] = 10;
521   $set['module'] = '';
522   $set['category'] = 'Internal Use';
523   $set['emptyok'] = 1;
524   $set['name'] = 'Asterisk Application VQA';
525   $set['description'] = "Set to the application name if the application is present in this Asterisk install";
526   $set['type'] = CONF_TYPE_TEXT;
527   $freepbx_conf->define_conf_setting('AST_APP_VQA',$set);
528 }
529 // Since modules can be loaded in a current version, we check these each time
530 // DEVICE_STATE exists in two flavors, DEVSTATE and DEVICE_STATE, the latter is the official one
531 // but back ports exists with the former with both.
532 //
533 if ($astman->func_exists('DEVICE_STATE')) {
534   $update_arr['AST_FUNC_DEVICE_STATE'] = 'DEVICE_STATE';
535 } else {
536   $update_arr['AST_FUNC_DEVICE_STATE'] = $astman->func_exists('DEVSTATE') ? 'DEVSTATE' : '';
537   // If they don't have DEVICE_STATE loaded in some form, force USEDEVSTATE off
538   if ($amp_conf['USEDEVSTATE'] && !$update_arr['AST_FUNC_DEVICE_STATE']) {
539     $update_arr['USEDEVSTATE'] = false;
540   }
541 }
542 $func_arr = array('EXTENSION_STATE', 'SHARED', 'CONNECTEDLINE', 'MASTER_CHANNEL');
543 foreach ($func_arr as $func) {
544   $update_arr['AST_FUNC_'.$func] = $astman->func_exists($func) ? $func : '';
545 }
546
547 $app_arr = array('VQA');
548 foreach ($app_arr as $app) {
549   $update_arr['AST_APP_'.$app] = $astman->app_exists($app) ? $app : '';
550 }
551 $freepbx_conf->set_conf_values($update_arr, true, true);
552
553 $nt = notifications::create($db);
554
555 $conf_change = _("Conference Room App Changed");
556 $conf_change_desc = _("Your Conference Room App (ASTCONFAPP) was automatically changed from %s to %s because %s is not installed on your Asterisk installation");
557
558 $conf_missing = _("No Conference Room App");
559 $conf_missing_desc = _("Neither app_meetme nor app_confbridge is configured in Asterisk, conferencing, paging and other functionality will not work properly");
560
561 if ($amp_conf['ASTCONFAPP'] == 'app_meetme' && !$astman->app_exists('meetme')) {
562   if ($astman->app_exists('confbridge')) {
563     $freepbx_conf->set_conf_values(array('ASTCONFAPP' => 'app_confbridge'), true, true);
564     $nt->add_notice('framework', 'ASTCONFAPPCHG', $conf_change, sprintf($conf_change_desc,'app_meetme','app_confbridge','app_meetme'));
565     $nt->delete('framework', 'ASTCONFAPPMISSING');
566   } else {
567     $nt->add_error('framework', 'ASTCONFAPPMISSING', $conf_missing, $conf_missing_desc);
568   }
569 } elseif ($amp_conf['ASTCONFAPP'] == 'app_confbridge' && !$astman->app_exists('confbridge')) {
570   if ($astman->app_exists('meetme')) {
571     $freepbx_conf->set_conf_values(array('ASTCONFAPP' => 'app_meetme'), true, true);
572     $nt->add_notice('framework', 'ASTCONFAPPCHG', $conf_change, sprintf($conf_change_desc,'app_confbridge','app_meetme','app_confbridge'));
573     $nt->delete('framework', 'ASTCONFAPPMISSING');
574   } else {
575     $nt->add_error('framework', 'ASTCONFAPPMISSING', $conf_missing, $conf_missing_desc);
576   }
577 } else {
578   $nt->delete('framework', 'ASTCONFAPPMISSING');
579 }
580
581 // Check for and report any extension conflicts
582 //
583
584 $extens_ok = true;
585 $dests_ok = true;
586
587 $my_hash = array_flip($module_list);
588 $my_prob_extens = $skip_registry_checks ? false : framework_list_extension_conflicts($my_hash);
589
590 if (empty($my_prob_extens)) {
591   $nt->delete('retrieve_conf', 'XTNCONFLICT');
592 } else {
593   $previous = null;
594   $str = null;
595   $count = 0;
596   foreach ($my_prob_extens as $extens) {
597     foreach ($extens as $exten => $details) {
598       if ($exten != $previous) {
599         $str .=  "Extension: $exten:<br />";
600         $count++;
601       }
602       $str .= sprintf("%8s: %s<br />",$details['status'], $details['description']);
603       $previous = $exten;
604     }
605   }
606   $nt->add_error('retrieve_conf', 'XTNCONFLICT', sprintf(_("There are %s conflicting extensions"),$count), $str);
607   $extens_ok = false;
608 }
609
610 // Check for and report any bogus destinations
611 //
612 $my_probs = $skip_registry_checks ? false : framework_list_problem_destinations($my_hash, !$amp_conf['CUSTOMASERROR']);
613
614 if (empty($my_probs)) {
615   $nt->delete('retrieve_conf', 'BADDEST');
616 } else {
617   $results = array();
618   $count = 0;
619   $str = null;
620   foreach ($my_probs as $problem) {
621     //print_r($problem);
622     $results[$problem['status']][] = $problem['description'];
623     $count++;
624   }
625   foreach ($results as $status => $subjects) {
626     $str .= sprintf(_("DEST STATUS: %s%s"),$status,"\n");
627     foreach ($subjects as $subject) {
628       //$str .= $subject."<br />";
629       $str .= "   ".$subject."\n";
630     }
631   }
632   $nt->add_error('retrieve_conf', 'BADDEST', sprintf(_("There are %s bad destinations"),$count), $str);
633   $dests_ok = false;
634 }
635
636 if ((!$extens_ok && $amp_conf['XTNCONFLICTABORT']) || (!$dests_ok && $amp_conf['BADDESTABORT'])) {
637   out(_("Aborting reload because extension conflicts or bad destinations"));
638   exit(20);
639 }
640
641 // run all of the *_get_config and _hookGet_config functions, which will populate the appropriate objects
642 if(isset($module_list) && is_array($module_list)){
643   foreach($module_list as $module) {
644     $funcname = $module."_get_config";
645     if (function_exists($funcname)) {
646       $funcname($engine);
647     }
648   }
649   foreach($module_list as $module) {
650     $funcname = $module."_hookGet_config";
651     if (function_exists($funcname)) {
652       $funcname($engine);
653     }
654   }
655 }
656
657 // extensions_additional.conf
658 // create the from-internal-additional contexts so other can add to it
659 $ext->add('from-internal-additional', 'h', '', new ext_hangup(''));
660 $ext->add('from-internal-noxfer-additional', 'h', '', new ext_hangup(''));
661 //echo $ext->get_filename();
662 //echo $ext->generateConf();
663 write_file($ext->get_filename(),$ext->generateConf());
664
665 // now we write out our conf files for modules
666 // check for any objects for each of the active modules
667 // ** conferences is an example of a module that write a conf
668 if(isset($module_list) && is_array($module_list)){
669   foreach($module_list as $active_module) {
670     $classname = $active_module."_conf";
671     if(class_exists($classname) && get_class(${$classname}) !== false) {
672       //echo ${$classname}->get_filename();
673       //echo ${$classname}->generateConf();
674       
675       // if the module returns an array, it wants to write multiple files
676       // ** pinsets is an example of a module that does this
677       if (is_array(${$classname}->get_filename())) {
678         foreach(${$classname}->get_filename() as $modconf) {
679           if (isset(${$classname}->use_warning_banner)) {
680             write_file($modconf,
681                   ${$classname}->generateConf($modconf),
682                   ${$classname}->use_warning_banner);
683           } else {
684             write_file($modconf,${$classname}->generateConf($modconf));
685           }
686         }
687       } else {
688         if (isset(${$classname}->use_warning_banner)) {
689           write_file(${$classname}->get_filename(),
690                 ${$classname}->generateConf(),
691                 ${$classname}->use_warning_banner);
692         } else {
693           write_file(${$classname}->get_filename(), ${$classname}->generateConf());
694         }
695       }
696     }
697   }
698 }
699 // Now we write on amportal.conf if it is writable, which allows legacy applications in the
700 // eco-system to take advantage of the settings.
701 // we write out the error message here instead of in freepbx_settings so that we don't hit the db every single page load
702 //
703 if ($freepbx_conf->amportal_canwrite()) {
704   file_put_contents('/etc/amportal.conf',$freepbx_conf->amportal_generate(true));
705   $nt->delete('framework', 'AMPORTAL_NO_WRITE');
706 } elseif (!$nt->exists('framework', 'AMPORTAL_NO_WRITE')) {
707   $nt->add_error('framework', 'AMPORTAL_NO_WRITE', _("amportal.conf not writeable"), _("Your amportal.conf file is not writeable. FreePBX is running in a crippled mode until changed. You can run 'amportal chown' from the Linux command line to rectify this."),true);
708 }
709
710 // Let's move some more of our checks to retrieve_conf so that we are not constantly checking these on page loads
711 //
712
713 // Warn about default Manager Interface Password
714 //
715 if ($amp_conf['AMPMGRPASS'] == $freepbx_conf->get_conf_default_setting('AMPMGRPASS')) {
716   if (!$nt->exists('core', 'AMPMGRPASS')) {
717     $nt->add_warning('core', 'AMPMGRPASS', _("Default Asterisk Manager Password Used"), _("You are using the default Asterisk Manager password that is widely known, you should set a secure password"));
718   }
719 } else {
720   $nt->delete('core', 'AMPMGRPASS');
721 }
722  
723 // Warn about default ARI Admin Password
724 //
725 if ($amp_conf['ARI_ADMIN_PASSWORD'] == $freepbx_conf->get_conf_default_setting('ARI_ADMIN_PASSWORD')) {
726   if (!$nt->exists('ari', 'ARI_ADMIN_PASSWORD')) {
727     $nt->add_warning('ari', 'ARI_ADMIN_PASSWORD', _("Default ARI Admin password Used"), _("You are using the default ARI Admin password that is widely known, you should change to a new password. Do this in Advanced Settings"));
728   }
729 } else {
730   $nt->delete('ari', 'ARI_ADMIN_PASSWORD');
731 }
732  
733 // Warn about default Database Password
734 //
735 if ($amp_conf['AMPDBPASS'] == $freepbx_conf->get_conf_default_setting('AMPDBPASS')) {
736   if (!$nt->exists('core', 'AMPDBPASS')) {
737     $nt->add_warning('core', 'AMPDBPASS', _("Default SQL Password Used"), _("You are using the default SQL password that is widely known, you should set a secure password"));
738   }
739 } else {
740   $nt->delete('core', 'AMPDBPASS');
741 }
742
743 // Warn if in deviceanduser mode and not using DYNAMICHINTS
744 //
745 if ($amp_conf['AMPEXTENSIONS'] == 'deviceanduser' && !$amp_conf['DYNAMICHINTS']) {
746   if (!$nt->exists('framework', 'NO_DYNAMICHINTS')) {
747     $nt->add_warning('framework', 'NO_DYNAMICHINTS', _("Device & User Hints Issue"), _("You are set to Device and User mode but are not set to 'Dynamically Generate Hints' which can result in improper phone state behavior. This can be changed on the Advanced Settings page, check the tooltip for specific configuration details."));
748   }
749 } else {
750   $nt->delete('framework', 'NO_DYNAMICHINTS');
751 }
752
753 function write_file($filename,$contents,$use_warning_banner=true) {
754   global $asterisk_conf;
755   if (isset($filename) && !empty($filename)) {
756     if ($fd = fopen(addslash($asterisk_conf['astetcdir']).$filename, "w")) {
757       if ($use_warning_banner) {
758         fwrite($fd, WARNING_BANNER );
759       }
760       fwrite($fd, $contents);
761       fclose($fd);
762     }
763   }
764 }
765
766 /* file_exists_wrapper()
767  * wrapper for file_exists() with the following additonal functionality.
768  * if the file is a symlink, it will check if the link exists and if not
769  * it will try to remove this file. It returns a false (file does not exists)
770  * if the file is successfully removed, true if not. If not a symlink, just
771  * returns file_exists()
772  */
773 function file_exists_wrapper($string) {
774   if (is_link($string)) {
775     $linkinfo = readlink($string);
776     if ($linkinfo === false) {
777       //TODO: throw error?
778       return !unlink($string);
779     } else {
780       if (file_exists($linkinfo)) {
781         return true;
782       } else {
783         return !unlink($string);
784       }
785     }
786   } else {
787     return file_exists($string);
788   }
789 }
790
791 //based on: http://snippets.dzone.com/posts/show/155
792 function listdir($directory, $recursive=true) {
793   $array_items = array();
794     if ($handle = opendir($directory)) {
795       while (false !== ($file = readdir($handle))) {
796         if ($file != "." && $file != "..") {
797           if (is_dir($directory. "/" . $file)) {
798             if($recursive) {
799               $array_items = array_merge($array_items, listdir($directory. "/" . $file, $recursive));
800             }
801           $file = $directory . "/" . $file;
802           $array_items[] = preg_replace("/\/\//si", "/", $file);
803         }else{
804           $file = $directory . "/" . $file;
805           $array_items[] = preg_replace("/\/\//si", "/", $file);
806         }
807       }
808     }
809     closedir($handle);
810   }
811   return array_reverse($array_items);//reverse so that we get directories BEFORE the files that are in them
812 }
813
814 /** Check if there is a job running, if one is found then all is good, if one is not found, it will be added and a
815  *  notification will be sent.
816  */
817 function install_cron_scheduler() {
818   global $amp_conf;
819   global $nt;
820
821   // crontab appears to return an error when no entries, os only fail if error returned AND a list of entries.
822   // Don't know if this will ever happen, but a failure and a list could indicate something wrong.
823   //
824   $outlines = array();
825   exec("/usr/bin/crontab -l", $outlines, $ret);
826   if ($ret && count($outlines)) {
827     $nt->add_error('retrieve_conf', 'CRONMGR', _("Failed to check crontab for cron manager"), sprintf(_("crontab returned %s error code when checking for crontab entries to start freepbx-cron-scheduler.php crontab manager"),$ret));
828   } else {
829     $nt->delete('retrieve_conf', 'CRONMGR');
830     $outlines2 = preg_grep("/freepbx-cron-scheduler.php/",$outlines);
831     $cnt = count($outlines2);
832     switch ($cnt) {
833       case 0:
834         /** grab any other cronjobs that are running as asterisk and NOT associated with backups
835         *  this code was taken from the backup module for the most part. But seems to work...
836         */
837         $outlines = array();
838         exec("/usr/bin/crontab -l | grep -v ^#\ DO\ NOT | grep -v ^#\ \( |  grep -v freepbx-cron-scheduler.php", $outlines, $ret);
839         $crontab_entry = "";
840         foreach ($outlines as $line) {
841           $crontab_entry .= $line."\n";
842         }
843         // schedule to run hourly, at a random time. The random time is explicit to accomodate things like module_admin online update checking
844         // since we will want a random access to the server. In the case of module_admin, that will also be scheduled randomly within the hour
845         // that it is to run
846         //
847         $crontab_entry .= rand(0,59)." * * * * ".$amp_conf['AMPBIN']."/freepbx-cron-scheduler.php";
848         system("/bin/echo '$crontab_entry' | /usr/bin/crontab -");
849         break;
850       case 1:
851         // already running, nothing to do
852         break;
853       default:
854         // error, there should never be more than one running
855         echo "TODO: deal with error here\n";
856         $nt->add_error('retrieve_conf', 'CRONMGR', _("Multiple freepbx-cron-scheduler.php running"), sprintf(_("There were %s freepbx-cron-scheduler.php instances running. There should be only 1."),$cnt));
857     }
858   }
859 }
860
861 // Check and install the freepbx-cron-scheduler.php manager
862 //
863 install_cron_scheduler();
864
865
866 // run retrieve_conf_post_custom
867 // If the following file exists, it will be run. This allows customization to be run automatically after the normal
868 // processing. Caution should be taken using this as it is only deisgned for expert usage. Errors in the code will
869 // have bad consequences and can cripple the system.
870 //
871 if ($amp_conf['AMPLOCALBIN']) {
872 $post_custom = $amp_conf['AMPLOCALBIN'].'/retrieve_conf_post_custom';
873   if (file_exists($post_custom)) {
874     outn(sprintf(_("Found script %s, executing.."), $post_custom));
875     include($post_custom);
876     out(_("OK"));
877   }
878 }
879
880 /* As of Asterisk 1.4.16 or there abouts, a missing #include file will make the reload fail. So
881    we need to make sure that we have such for everything that is in our configs. We will simply
882    look for the #include statements and touch the files vs. trying to inventory everything we may
883    need and then forgetting something.
884 */
885
886 $output = array();
887 exec("grep '#include' ".$amp_conf['ASTETCDIR']."/*.conf | sed 's/;.*//; s/#include//'",$output,$retcode);
888 if ($retcode != 0) {
889   error("Error code $retcode: trying to search for missing #include files");
890 }
891
892 foreach($output as $file) {
893   if (trim($file) == '') {
894     continue;
895   }
896   $parse1 = explode(':',$file);
897   $parse2 = explode(';',$parse1[1]);
898   $rawfile = trim($parse2[0]);
899   if ($rawfile == '') {
900     continue;
901   }
902
903   $target = ($rawfile[0] == '/') ? $rawfile : $amp_conf['ASTETCDIR']."/$rawfile";
904
905   if (!file_exists($target)) {
906     $output = array();
907     exec("touch $target", $output, $retcode);
908     if ($retcode != 0) {
909       error("Error code $retcode: trying to create empty file $target");
910     }
911   }
912 }
913
914 // Some later versions of Aserisk require the existence of a cdr.conf file or no CDR
915 // incuding MySQL logging will work (see #3940)
916 //
917 $target = $amp_conf['ASTETCDIR']."/cdr.conf";
918 if (!file_exists($target)) {
919   $output = array();
920   exec("touch $target", $output, $retcode);
921   if ($retcode != 0) {
922     error("Error code $retcode: trying to create empty file $target");
923   }
924 }
925
926 // **** Set reload flag for AMP admin
927 needreload();
928 if (isset($amp_conf["AMPWEBADDRESS"]) && $amp_conf["AMPWEBADDRESS"])
929 {
930   out(sprintf(_("Please update your modules and reload Asterisk by visiting %s"), "http://".$amp_conf["AMPWEBADDRESS"]."/admin"),false);
931 }
932 else
933 {
934   out(_("Please update your modules and reload Asterisk by browsing to your server."),false);
935 }
936   $nt->delete('retrieve_conf', 'FATAL');
937 ?>
Note: See TracBrowser for help on using the browser.