Changeset 5723
- Timestamp:
- 02/24/08 06:46:56 (9 months ago)
- Files:
-
- freepbx/trunk (modified) (2 props)
- freepbx/trunk/CHANGES (modified) (1 diff)
- freepbx/trunk/SQL/newinstall.sql (modified) (1 diff)
- freepbx/trunk/SQL/newinstall.sqlite3.sql (modified) (1 diff)
- freepbx/trunk/amp_conf/astetc/cdr_mysql.conf (modified) (1 diff)
- freepbx/trunk/amp_conf/astetc/extensions_custom.conf.sample (modified) (1 diff)
- freepbx/trunk/amp_conf/astetc/features.conf (deleted)
- freepbx/trunk/amp_conf/bin/retrieve_conf (modified) (1 diff)
- freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl (modified) (4 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/extensions.class.php (modified) (7 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php (modified) (5 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/page.modules.php (modified) (2 diffs)
- freepbx/trunk/amp_conf/htdocs_panel/op_buttons.cfg (modified) (7 diffs)
- freepbx/trunk/buildtools/generate-release.sh (modified) (2 diffs)
- freepbx/trunk/install_amp (modified) (6 diffs)
- freepbx/trunk/upgrades/2.3.0rc1/removefiles.php (deleted)
- freepbx/trunk/upgrades/2.3.0rc1/tables.php (deleted)
- freepbx/trunk/upgrades/2.4.0 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0)
- freepbx/trunk/upgrades/2.4.0.md5 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0.md5)
- freepbx/trunk/upgrades/2.4.0beta1.md5 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0beta1.md5)
- freepbx/trunk/upgrades/2.4.0beta2 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0beta2)
- freepbx/trunk/upgrades/2.4.0beta2.md5 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0beta2.md5)
- freepbx/trunk/upgrades/2.4.0beta2/core_migrate.php (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0beta2/core_migrate.php)
- freepbx/trunk/upgrades/2.4.0beta2/tables.php (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0beta2/tables.php)
- freepbx/trunk/upgrades/2.4.0rc1 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0rc1)
- freepbx/trunk/upgrades/2.4.0rc1.md5 (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0rc1.md5)
- freepbx/trunk/upgrades/2.4.0rc1/core_migrate.php (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0rc1/core_migrate.php)
- freepbx/trunk/upgrades/2.4.0rc1/tables.php (copied) (copied from freepbx/branches/2.4/upgrades/2.4.0rc1/tables.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk
- Property svnmerge-blocked changed from /freepbx/trunk:4134,4137-4139 to /freepbx/branches/2.3:4130,4132,4135,4997,5002,5004,5020,5028,5035-5037,5043,5077,5096,5101-5102,5108,5118,5123,5133-5134,5152,5154,5216,5236,5248,5295,5489 /freepbx/trunk:4134,4137-4139
- Property svnmerge-integrated changed from /freepbx/branches/2.4:1-5453 to /freepbx/branches/2.4:1-5722
freepbx/trunk/CHANGES
r5399 r5723 88 88 - Queues and the SIP, IAX2 and ZAP conf file generation has been replaced with proper queues_conf 89 89 and core_conf classes 90 91 - Added partial support for DUNDi via a DUNDi trunk, dundi.conf configuration is still manual 92 93 - Support Asterisk 1.6 to the extent that it can be supported as it is in beta at the time of 94 2.4 release. But we will try to keep on top of 1.6 issues. 90 95 91 96 - Misc other bug fixes and some feature requests that can be obtained through the SVN log. freepbx/trunk/SQL/newinstall.sql
r5346 r5723 332 332 `id` varchar(20) NOT NULL default 'xml', 333 333 `time` int(11) NOT NULL default '0', 334 `data` blob NOT NULL,334 `data` mediumblob NOT NULL, 335 335 PRIMARY KEY (`id`) 336 336 ); freepbx/trunk/SQL/newinstall.sqlite3.sql
r5346 r5723 328 328 `id` varchar(20) NOT NULL default 'xml', 329 329 `time` int(11) NOT NULL default '0', 330 `data` blob NOT NULL,330 `data` mediumblob NOT NULL, 331 331 PRIMARY KEY (`id`) 332 332 ); freepbx/trunk/amp_conf/astetc/cdr_mysql.conf
r79 r5723 1 ; 2 ; Note - if the database server is hosted on the same machine as the 3 ; asterisk server, you can achieve a local Unix socket connection by 4 ; setting hostname=localhost 5 ; 6 ; port and sock are both optional parameters. If hostname is specified 7 ; and is not "localhost", then cdr_mysql will attempt to connect to the 8 ; port specified or use the default port. If hostname is not specified 9 ; or if hostname is "localhost", then cdr_mysql will attempt to connect 10 ; to the socket file specified by sock or otherwise use the default socket 11 ; file. 12 ; 13 [global] 14 hostname=localhost 15 dbname=asteriskcdrdb 16 password=AMPDBPASS 17 user=AMPDBUSER 18 ;port=3306 19 ;sock=/tmp/mysql.sock 1 ; 2 ; Note - if the database server is hosted on the same machine as the 3 ; asterisk server, you can achieve a local Unix socket connection by 4 ; setting hostname=localhost 5 ; 6 ; port and sock are both optional parameters. If hostname is specified 7 ; and is not "localhost", then cdr_mysql will attempt to connect to the 8 ; port specified or use the default port. If hostname is not specified 9 ; or if hostname is "localhost", then cdr_mysql will attempt to connect 10 ; to the socket file specified by sock or otherwise use the default socket 11 ; file. 12 ; 13 [global] 14 hostname=localhost 15 dbname=asteriskcdrdb 16 password=AMPDBPASS 17 user=AMPDBUSER 18 userfield=1 19 ;port=3306 20 ;sock=/tmp/mysql.sock freepbx/trunk/amp_conf/astetc/extensions_custom.conf.sample
r257 r5723 2 2 ; extensions_custom.conf should be used to include customizations 3 3 ; to AMP's Asterisk dialplan. 4 5 ; All custom context should contain the string 'custom' in it's name6 4 7 5 ; Extensions in AMP have access to the 'from-internal' context. freepbx/trunk/amp_conf/bin/retrieve_conf
r5331 r5723 707 707 } 708 708 709 /* As of Asterisk 1.4.16 or there abouts, a missing #include file will make the reload fail. So 710 we need to make sure that we have such for everything that is in our configs. We will simply 711 look for the #include statements and touch the files vs. trying to inventory everything we may 712 need and then forgetting something. 713 */ 714 715 exec("grep '#include' ".$amp_conf['ASTETCDIR']."/*.conf | sed 's/;.*//; s/#include//'",$output,$retcode); 716 if ($retcode != 0) { 717 error("Error code $retcode: trying to search for missing #include files"); 718 } 719 720 foreach($output as $file) { 721 if (trim($file) == '') { 722 continue; 723 } 724 $parse1 = explode(':',$file); 725 $parse2 = explode(';',$parse1[1]); 726 $rawfile = trim($parse2[0]); 727 if ($rawfile == '') { 728 continue; 729 } 730 731 $target = ($rawfile[0] == '/') ? $rawfile : $amp_conf['ASTETCDIR']."/$rawfile"; 732 733 if (!file_exists($target)) { 734 exec("touch $target", $output, $retcode); 735 error("Error code $retcode: trying to create empty file $target"); 736 } 737 } 738 739 709 740 // **** Set reload flag for AMP admin 710 741 needreload(); freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl
r4993 r5723 29 29 ######## STYLE INFO ######### 30 30 $extenpos="2-40"; 31 $trunkpos="52-60,71-80"; 32 $confepos=""; 33 $queuepos="42-50,61-70"; 31 #$trunkpos="52-60,71-80"; 32 #$confepos=""; 33 #$queuepos="42-50,61-70"; 34 35 ## SME server changes 36 $trunkpos="53-60,72-80"; 37 $parkingpos="50-51,69-71"; 38 $confepos="46-48,65-68"; 39 $queuepos="42-44,61-64"; 40 41 # End of changes 34 42 35 43 # Remove or add Zap trunks as needed … … 226 234 #Next, populate queues 227 235 @queues=(); 228 if (table_exists($dbh," extensions")) {229 $statement = "SELECT extension,descr from extensions where application='Queue' and flags <> 1order by extension";236 if (table_exists($dbh,"queues_config")) { 237 $statement = "SELECT extension,descr from queues_config order by extension"; 230 238 $result = $dbh->selectall_arrayref($statement); 231 239 @resultSet = @{$result}; … … 236 244 } 237 245 246 247 ## SME server chnges 248 249 #Next, populate conferences 250 @conferences=(); 251 if(table_exists($dbh,"meetme")) { 252 $statement = "SELECT exten,description FROM meetme ORDER BY exten"; 253 $result = $dbh->selectall_arrayref($statement); 254 @resultSet = @{$result}; 255 if ( $#resultSet == -1 ) { 256 print "Notice: no Conferences defined\n"; 257 } 258 push(@conferences, @{ $result }); 259 } 260 261 262 #Next, populate parkings 263 @parkings=(); 264 if(table_exists($dbh,"parkinglot")) { 265 $statement = "SELECT keyword,data FROM parkinglot"; 266 $result = $dbh->selectall_arrayref($statement); 267 @resultSet = @{$result}; 268 if ( $#resultSet == -1 ) { 269 print "Notice: no Parkings defined\n"; 270 } 271 push(@parkings, @{ $result }); 272 } 273 274 ## End of changes 238 275 #Next, populate trunks (sip and iax) 239 276 @trunklist=(); … … 353 390 354 391 392 ## SME server changes 393 394 395 ### Write Parkings lots 396 $btn=0; 397 my $parken ; 398 my $extpark ; 399 my $parkcontext ; 400 my $numberlots ; 401 foreach my $row ( @parkings ) { 402 if (@{$row}[0] eq "parkingenabled") { 403 $parken = @{$row}[1] ; 404 } 405 if (@{$row}[0] eq "parkext") { 406 $extpark = @{$row}[1] ; 407 } 408 if (@{$row}[0] eq "parkingcontext") { 409 $parkcontext = @{$row}[1] ; 410 } 411 if (@{$row}[0] eq "numslots") { 412 $numberlots = @{$row}[1] ; 413 } 414 } 415 if ($parken eq "s") { 416 for (my $i = 0 ; $i < $numberlots && $i < 5 ; $i++ ) { 417 $btn=get_next_btn($parkingpos,$btn); 418 $parknum = $extpark + $i ; 419 $icon='1'; 420 print EXTEN "[PARK$parknum]\nPosition=$btn\nLabel=\"Parked ($parknum)\"\nExtension=$parknum\nContext=$parkcontext\nIcon=$icon\nPanel_Context=$panelcontext\n"; 421 } 422 } 423 424 ## End of chagnes 355 425 ### Write conferences (meetme) 356 426 freepbx/trunk/amp_conf/htdocs/admin/extensions.class.php
r5317 r5723 94 94 function addInclude($section, $incsection) { 95 95 $this->_includes[$section][] = $incsection; 96 } 97 98 function addSwitch($section, $incsection) { 99 $this->_switches[$section][] = $incsection; 96 100 } 97 101 … … 187 191 foreach ($this->_includes[$section] as $include) { 188 192 $output .= "include => ".$include."\n"; 193 } 194 } 195 if (isset($this->_switches[$section])) { 196 foreach ($this->_switches[$section] as $include) { 197 $output .= "switch => ".$include."\n"; 189 198 } 190 199 } … … 516 525 } 517 526 527 class ext_parkedcall extends extension { 528 function output() { 529 return "ParkedCall(".$this->data.")"; 530 } 531 } 532 533 518 534 class ext_resetcdr extends extension { 519 535 function output() { … … 574 590 } 575 591 592 // The app_false argument only works with asterisk 1.6 593 // 576 594 class ext_execif { 577 595 var $expr; 578 var $app; 579 var $data; 580 581 function ext_execif($expr, $app, $data='') { 596 var $app_true; 597 var $data_true; 598 var $app_false; 599 var $data_false; 600 601 function ext_execif($expr, $app_true, $data_true='', $app_false = '', $data_false = '') { 582 602 $this->expr = $expr; 583 $this->app = $app; 584 $this->data = $data; 585 } 586 587 function output() { 588 return "ExecIf(".$this->expr.",".$this->app.",".$this->data.")"; 603 $this->app_true = $app_true; 604 $this->data_true = $data_true; 605 $this->app_false = $app_false; 606 $this->data_false = $data_false; 607 } 608 609 function output() { 610 global $version; 611 612 if (version_compare($version, "1.6", "ge")) { 613 if ($app_false != '') 614 return "ExecIf({$this->expr}?{$this->app_true}({$this->data_true}):{$this->app_false}({$this->data_false}))"; 615 else 616 return "ExecIf({$this->expr}?{$this->app_true}({$this->data_true}))"; 617 } else { 618 return "ExecIf({$this->expr},{$this->app_true},{$this->data_true})"; 619 } 589 620 } 590 621 } … … 593 624 function output() { 594 625 return "Set(CALLERID(name)=".$this->data.")"; 626 } 627 } 628 629 class ext_setcallerpres extends extension { 630 function output() { 631 return "SetCallerPres({$this->data})"; 595 632 } 596 633 } … … 627 664 else 628 665 return "Queue(".$this->queuename.",".$this->options.",".$this->optionalurl.",".$this->announceoverride.")"; 666 } 667 } 668 669 class ext_addqueuemember extends extension { 670 var $queue; 671 var $channel; 672 673 function ext_addqueuemember($queue, $channel){ 674 $this->queue = $queue; 675 $this->channel = $channel; 676 } 677 678 function output() { 679 return "AddQueueMember({$this->queue},{$this->channel})"; 680 } 681 } 682 683 class ext_removequeuemember extends extension { 684 var $queue; 685 var $channel; 686 687 function ext_removequeuemember($queue, $channel){ 688 $this->queue = $queue; 689 $this->channel = $channel; 690 } 691 692 function output() { 693 return "RemoveQueueMember({$this->queue},{$this->channel})"; 694 } 695 } 696 697 class ext_userevent extends extension { 698 var $eventname; 699 var $body; 700 701 function ext_userevent($eventname, $body=""){ 702 $this->eventname = $eventname; 703 $this->body = $body; 704 } 705 706 function output() { 707 if ($this->body == '') 708 return "UserEvent({$this->eventname})"; 709 else 710 return "UserEvent({$this->eventname},{$this->body})"; 711 } 712 } 713 714 class ext_macroexit extends extension { 715 function output() { 716 return "MacroExit()"; 629 717 } 630 718 } … … 1037 1125 } 1038 1126 } 1127 1128 class ext_setlanguage extends extension { 1129 function output() { 1130 global $version; 1131 1132 if (version_compare($version, "1.4", "ge")) { 1133 return "Set(CHANNEL(language)={$this->data})"; 1134 } else { 1135 return "Set(LANGUAGE()={$this->data})"; 1136 } 1137 } 1138 } 1139 1039 1140 1040 1141 /* example usage freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php
r5448 r5723 1029 1029 } elseif (preg_match('/Asterisk SVN-trunk-r(-?(\S*))/', $verinfo, $matches)) { 1030 1030 return array('engine'=>'asterisk', 'version' => '1.6', 'additional' => $matches[1]); 1031 } elseif (preg_match('/Asterisk SVN-.+-(\d+(\.\d+)*)-r(-?(\S*))-(.+)/', $verinfo, $matches)) { 1032 return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[3]); 1031 1033 } 1032 1034 … … 1038 1040 1039 1041 1040 /* verison_compare that works with freePBX version numbers 1041 */ 1042 function version_compare_freepbx($version1, $version2, $op = null) { 1043 $version1 = str_replace("rc","RC", strtolower($version1)); 1044 $version2 = str_replace("rc","RC", strtolower($version2)); 1045 if (!is_null($op)) { 1046 return version_compare($version1, $version2, $op); 1047 } else { 1048 return version_compare($version1, $version2); 1049 } 1042 if (!function_exists('version_compare_freepbx')) { 1043 /* verison_compare that works with freePBX version numbers 1044 */ 1045 function version_compare_freepbx($version1, $version2, $op = null) { 1046 $version1 = str_replace("rc","RC", strtolower($version1)); 1047 $version2 = str_replace("rc","RC", strtolower($version2)); 1048 if (!is_null($op)) { 1049 return version_compare($version1, $version2, $op); 1050 } else { 1051 return version_compare($version1, $version2); 1052 } 1053 } 1050 1054 } 1051 1055 … … 1154 1158 } 1155 1159 1156 $retrieve = $amp_conf['AMPBIN'].'/retrieve_conf ';1160 $retrieve = $amp_conf['AMPBIN'].'/retrieve_conf 2>&1'; 1157 1161 //exec($retrieve.'&>'.$asterisk_conf['astlogdir'].'/freepbx-retrieve.log', $output, $exit_val); 1158 1162 exec($retrieve, $output, $exit_val); … … 3315 3319 // Now we have the id and know if this is a firstime install so we can get the announcement 3316 3320 // 3317 $options = "?installid=". $installid;3321 $options = "?installid=".urlencode($installid); 3318 3322 3319 3323 if (trim($type) != "") { 3320 $options .= "&type=". $type;3324 $options .= "&type=".urlencode($type); 3321 3325 } 3322 3326 if ($firstinstall) { … … 3325 3329 $engver=engine_getinfo(); 3326 3330 if ($engver['engine'] == 'asterisk') { 3327 $options .="&astver=". $engver['version'];3331 $options .="&astver=".urlencode($engver['version']); 3328 3332 } 3329 3333 freepbx/trunk/amp_conf/htdocs/admin/page.modules.php
r5270 r5723 517 517 echo "<a href='config.php?display=modules&type=tool'>"._("Manage local modules")."</a>\n"; 518 518 if (!EXTERNAL_PACKAGE_MANAGEMENT) { 519 echo " | <a href='config.php?display=modules&type=tool&online=1'>"._("Check for updates online")."</a>\n";519 echo " | <a class='info' href='config.php?display=modules&type=tool&online=1'>"._("Check for updates online")."<span>"._("Checking for updates will transmit your FreePBX and Asterisk version numbers along with a unique but random identifier. This is used to provide proper update information and track version usage to focus development and maintenance efforts. No private information is transmitted.")."</span></a>\n"; 520 520 } 521 521 … … 576 576 } else { 577 577 if (!EXTERNAL_PACKAGE_MANAGEMENT) { 578 echo "<a href='config.php?display=modules&type=tool&online=1'>"._("Check for updates online")."</a>\n";578 echo "<a class='info' href='config.php?display=modules&type=tool&online=1'>"._("Check for updates online")."<span>"._("Checking for updates will transmit your FreePBX and Asterisk version numbers along with a unique but random identifier. This is used to provide proper update information and track version usage to focus development and maintenance efforts. No private information is transmitted.")."</span></a>\n"; 579 579 } 580 580 echo " | <a href='config.php?display=modules&type=tool&extdisplay=upload'>"._("Upload module")."</a><br />\n"; freepbx/trunk/amp_conf/htdocs_panel/op_buttons.cfg
r2711 r5723 4 4 include => op_buttons_custom.cfg 5 5 6 ; queues6 ; Queues 7 7 [rectangle] 8 8 x=492 9 9 y=32 10 width= 24411 height= 27810 width=491 11 height=111 12 12 line_width=0 13 13 line_color=ff1010 … … 18 18 layer=bottom 19 19 20 ; parked20 ; Conferences 21 21 [rectangle] 22 x= 73623 y= 3224 width= 24725 height= 27822 x=492 23 y=144 24 width=491 25 height=111 26 26 line_width=0 27 line_color= ffff1028 fade_color1= ffff1027 line_color=006666 28 fade_color1=006666 29 29 fade_color2=a01000 30 30 rnd_border=2 … … 32 32 layer=bottom 33 33 34 ; trunks34 ; Parking 35 35 [rectangle] 36 36 x=492 37 y= 31237 y=256 38 38 width=491 39 height= 28339 height=84 40 40 line_width=0 41 line_color= 10ff1042 fade_color1= 10ff1043 fade_color2= 10ff0041 line_color=ffff10 42 fade_color1=ffff10 43 fade_color2=CC9933 44 44 rnd_border=2 45 45 alpha=20 46 46 layer=bottom 47 47 48 ; extensions 48 49 ; Trunks 50 [rectangle] 51 x=492 52 y=341 53 width=491 54 height=255 55 line_width=0 56 line_color=10ff10 57 fade_color1=10ff10 58 fade_color2=009900 59 rnd_border=2 60 alpha=20 61 layer=bottom 62 63 ; Extensions 49 64 [rectangle] 50 65 x=-1 … … 55 70 line_color=1010ff 56 71 fade_color1=1010ff 57 fade_color2= 1010ff72 fade_color2=99CCCC 58 73 rnd_border=2 59 74 alpha=10 … … 62 77 [LEGEND] 63 78 x=500 64 y=3 1579 y=342 65 80 text=Trunks 66 81 font_size=18 … … 69 84 70 85 [LEGEND] 71 x= 74572 y= 3273 text= Parking Lot86 x=500 87 y=144 88 text=Conferences 74 89 font_size=18 75 font_family=Times New Roman 90 font_family=Arial 91 use_embed_fonts=1 92 93 [LEGEND] 94 x=500 95 y=256 96 text=Parking lots 97 font_size=18 98 font_family=Arial 76 99 use_embed_fonts=1 77 100 … … 91 114 font_family=Arial 92 115 use_embed_fonts=1 93 94 [PARK71]95 Position=6296 extension=7097 Label="Parked (71)"98 Icon=199 100 [PARK72]101 Position=63102 extension=70103 Label="Parked (72)"104 Icon=1105 106 [PARK73]107 Position=64108 extension=70109 Label="Parked (73)"110 Icon=1111 112 [PARK74]113 Position=65114 extension=70115 Label="Parked (74)"116 Icon=1117 118 [PARK75]119 Position=66120 extension=70121 Label="Parked (75)"122 Icon=1123 124 [PARK76]125 Position=67126 extension=70127 Label="Parked (76)"128 Icon=1129 130 [PARK77]131 Position=68132 extension=70133 Label="Parked (77)"134 Icon=1135 136 [PARK78]137 Position=69138 extension=70139 Label="Parked (78)"140 Icon=1141 142 [PARK79]143 Position=70144 extension=70145 Label="Parked (79)"146 Icon=1147 freepbx/trunk/buildtools/generate-release.sh
r5124 r5723 11 11 framework_url=${module_url}/framework 12 12 dashboard_url=${module_url}/dashboard 13 customappsreg_url=${module_url}/customappsreg 13 14 voicemail_url=${module_url}/voicemail 14 15 recordings_url=${module_url}/recordings … … 68 69 svn cp -m "Automatic packaging of framework with $ver" $framework_url http://svn.freepbx.org/freepbx/tags/${ver}/amp_conf/htdocs/admin/modules/ 69 70 svn cp -m "Automatic packaging of dashboard with $ver" $dashboard_url http://svn.freepbx.org/freepbx/tags/${ver}/amp_conf/htdocs/admin/modules/ 71 svn cp -m "Automatic packaging of customappsreg with $ver" $customappsreg_url http://svn.freepbx.org/freepbx/tags/${ver}/amp_conf/htdocs/admin/modules/ 70 72 svn cp -m "Automatic packaging of voicemail with $ver" $voicemail_url http://svn.freepbx.org/freepbx/tags/${ver}/amp_conf/htdocs/admin/modules/ 71 73 svn cp -m "Automatic packaging of recordings with $ver" $recordings_url http://svn.freepbx.org/freepbx/tags/${ver}/amp_conf/htdocs/admin/modules/ freepbx/trunk/install_amp
r5019 r5723 88 88 } 89 89 90 function version_compare_freepbx($version1, $version2) { 91 $version1 = str_replace("rc","RC", strtolower($version1)); 92 $version2 = str_replace("rc","RC", strtolower($version2)); 93 return version_compare($version1, $version2); 90 if (!function_exists('version_compare_freepbx')) { 91 /* verison_compare that works with freePBX version numbers 92 */ 93 function version_compare_freepbx($version1, $version2, $op = null) { 94 $version1 = str_replace("rc","RC", strtolower($version1)); 95 $version2 = str_replace("rc","RC", strtolower($version2)); 96 if (!is_null($op)) { 97 return version_compare($version1, $version2, $op); 98 } else { 99 return version_compare($version1, $version2); 100 } 101 } 94 102 } 95 103 … … 455 463 if ($up_module != 'framework') { 456 464 system($amp_conf['AMPBIN']."/module_admin --no-warnings -f install $up_module"); 465 system($amp_conf['AMPBIN']."/module_admin --no-warnings -f enable $up_module"); 457 466 out("installed"); 458 467 } else { … … 493 502 // If we didn't return above, then we found the package as part of the install 494 503 // tarball and want to update the version info since this might be overwriting 495 // an dexisting install that has a newever version.504 // an existing install that has a newever version. 496 505 // 497 506 $sql = "SELECT version FROM modules WHERE modulename = '$module'"; … … 502 511 $sql = ""; 503 512 if (count($result) == 0) { 504 $sql = "INSERT INTO modules (modulename, version, enabled) VALUES ('$module', '$version', 1)"; 513 // insert but disable as we have to first run install scripts which come later 514 $sql = "INSERT INTO modules (modulename, version, enabled) VALUES ('$module', '$version', 0)"; 505 515 } else if ($result[0] != $version) { 506 $sql = "UPDATE modules SET version = '$version', enabled = 1 WHERE modulename = '$module'"; 516 if (version_compare_freepbx($version, $result[0], "gt")) { 517 // if new verison is greater than old, then we disable the module and it will get enabled next when installed 518 // 519 $sql = "UPDATE modules SET version = '$version', enabled = 0 WHERE modulename = '$module'"; 520 } else { 521 // if new version is equal to or less than old, then we leave it in the enable/disable state it was in but just 522 // reset the version number. 523 // 524 $sql = "UPDATE modules SET version = '$version', WHERE modulename = '$module'"; 525 } 507 526 } 508 527 if ($sql) { … … 550 569 // **** Parse out command-line options 551 570 $shortopts = "h?u:p:"; 552 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","dbname=","my-svn-is-correct","engine="," install-moh","make-links-devel","skip-module-install");571 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","dbname=","my-svn-is-correct","engine=","webroot=","install-moh","make-links-devel","skip-module-install"); 553 572 554 573 $args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); … … 838 857 fatal("Asterisk 1.2 or 1.4 is required for this version of FreePBX. Detected version is: ".$matches[1]); 839 858 } 840 if (version_compare($matches[1], "1.5", "ge")) { 841 fatal("Asterisk 1.2 or 1.4 is required for this version of FreePBX. Detected version is: ".$matches[1]); 842 } 859 if (version_compare($matches[1], "1.7", "ge")) { 860 fatal("Asterisk 1.2, 1.4, or 1.6 is required for this version of FreePBX. Detected version is: ".$matches[1]); 861 } 862 out("{$matches[1]}"); 843 863 } elseif (preg_match('/^Asterisk SVN.+/', $verinfo)) { 844 864 out("FAIL");
