Changeset 6683

Show
Ignore:
Timestamp:
09/10/08 12:14:35 (5 years ago)
Author:
p_lindheimer
Message:

closes #3182 add fw_langpacks and associated publishing tools

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/fw_langpacks/install.php

    r6500 r6683  
    33// HELPER FUNCTIONS: 
    44 
    5 function fw_ari_print_errors($src, $dst, $errors) { 
    6   echo "error copying fw_ari files:<br />'cp -rf' from src: '$src' to dst: '$dst'...details follow<br />"; 
     5function fw_langpacks_print_errors($src, $dst, $errors) { 
     6  echo "error copying fw_langpacks files:<br />'cp -rf' from src: '$src' to dst: '$dst'...details follow<br />"; 
    77  foreach ($errors as $error) { 
    88    echo "$error<br />"; 
     
    4444 
    4545global $amp_conf; 
    46 global $asterisk_conf; 
    4746 
    4847$debug = false; 
     
    6665 
    6766/* 
    68  * fw_ari install script 
     67 * fw_langpacks install script 
     68 * 
     69 * for each installed component on the target system, copy localization files using the -u option 
     70 * on copy which will only copy them if our copy is newer then the destination which protects 
     71 * from overwriting destination files that have been updated by the user. 
    6972 */ 
     73  $htdocs_source = dirname(__FILE__)."/htdocs"; 
     74  $htdocs_dest = $amp_conf['AMPWEBROOT']; 
    7075 
    71   $htdocs_ari_source = dirname(__FILE__)."/htdocs_ari/*"; 
    72   $htdocs_ari_dest = $amp_conf['AMPWEBROOT']."/recordings"; 
     76  // Always copy main FreePBX amp.po/mo files 
     77  // 
     78  out(sprintf(_("Preparing to copy %s to %s"),'i18n',"$htdocs_dest/admin")); 
     79  $htdocs_copy[] = array("source" => "$htdocs_source/admin/i18n", "dest" => "$htdocs_dest/admin"); 
    7380 
    74   exec("cp -rf $htdocs_ari_source $htdocs_ari_dest 2>&1",$out,$ret); 
    75   if ($ret != 0) { 
    76     fw_ari_print_errors($htdocs_panel_source, $htdocs_panel_dest, $out); 
     81  // If ARI is there copy those 
     82  // 
     83  if (is_dir("$htdocs_dest/recordings")) { 
     84    $htdocs_copy[] = array("source" => "$htdocs_source/recordings", "dest" => "$htdocs_dest"); 
     85    out(sprintf(_("Preparing to copy %s to %s"),'recordings',"$htdocs_dest")); 
     86  } else { 
     87    out(sprintf(_("No destination directory %s to copy %s to"),"$htodcs_dest/recordings","recordings")); 
    7788  } 
    7889 
     90  // Now for each module we have, make sure the module is in the destination as we don't want to create 
     91  // empty destinatino folders with just i18n directories. 
     92  // 
     93  $dir = opendir($htdocs_source.'/admin/modules'); 
     94  while ($file = readdir($dir)) { 
     95    if (is_dir("$htdocs_dest/admin/modules/$file") && ($file != ".") && ($file != "..")) { 
     96      out(sprintf(_("Preparing to copy %s to %s"),"$file","$htdocs_dest/admin/modules")); 
     97      $htdocs_copy[] = array("source" => "$htdocs_source/admin/modules/$file", "dest" => "$htdocs_dest/admin/modules"); 
     98    } else if ($file != "." && $file != "..") { 
     99      out(sprintf(_("No destination directory %s to copy %s to"),"$htodcs_dest/modules/$file","$file")); 
     100    } 
     101  } 
     102 
     103  foreach ($htdocs_copy as $translations) { 
     104    exec("cp -ru ".$translations['source']." ".$translations['dest']." 2>&1",$out,$ret); 
     105    if ($ret != 0) { 
     106      fw_langpacks_print_errors($translations['source'], $translations['dest'], $out); 
     107    } else { 
     108      out(sprintf(_("Updated %s"),basename($translations['source']))); 
     109    } 
     110  } 
    79111?> 
  • modules/branches/2.5/fw_langpacks/module.xml

    r6608 r6683  
    11<module> 
    2   <rawname>fw_ari</rawname> 
    3   <name>FreePBX ARI Framework</name> 
    4   <version>2.5.0.3</version> 
    5   <candisable>no</candisable> 
    6   <canuninstall>no</canuninstall> 
     2  <rawname>fw_langpacks</rawname> 
     3  <name>FreePBX Localization Updates</name> 
     4  <version>2.5.0</version> 
    75  <changelog> 
    8     *2.5.0.3* #3165, #3077, #2609 and additional fixes related to #3161 
    9     *2.5.0.2* r6505, #3161 SQL Injection vulnerability that could allow and authenticated user to access all CDRs and recordings 
    10     *2.5.0.1* remove inclusion of libfreepbx.install.php in install script resulting in warnings 
    11     *2.5.0* #3104 and First release of fw_ari 
     6    *2.5.0* First release 
    127  </changelog> 
    138  <description> 
    14     This module provides a facility to install bug fixes to the ARI code that is not otherwise housed in a module, it used to be part of framework but has been removed to isolate ARI from Framework updates
     9    This module provides a facility to install new and updated localization translations for all componets in FreePBX. Localization i18n translations are still kept with each module and other components such as the User Portal (ARI). This provides an easy ability to bring all components up-to-date without the need of publishing dozens of modules for every minor change. The localization updates used will be the latest available for all modules and will not consider the curent version you are running
    1510  </description> 
    1611  <type>setup</type> 
    1712  <category>Basic</category> 
    18   <location>release/2.5/fw_ari-2.5.0.3.tgz</location> 
    19   <md5sum>d345aeed410ba8180dc7b877412b8d03</md5sum> 
     13  <location>release/2.5/fw_langpacks-2.5.0.tgz</location> 
     14  <md5sum>4d31935ef78a53c3b70bb8ce32f0c8cd</md5sum> 
    2015</module> 
  • modules/branches/2.5/fw_langpackssvn.pl

    r6498 r6683  
    22 
    33# This script (sculpted from publish.pl) will check the last tarball (which must be there) 
    4 # based on the fw_ari xml version number and then run svn log against all updates since 
    5 # fw_ari was last published. 
     4# based on the fw_langpacks xml version number and then run svn log against all updates since 
     5# fw_langpacks was last published. 
    66# 
    77$rver = "2.5"; 
    8 $fw_ari = "fw_ari"; 
     8$fw_langpacks = "fw_langpacks"; 
    99 
    10 $moddir = 'fw_ari'; 
     10$moddir = 'fw_langpacks'; 
    1111 
    1212my $reldir = "release/"; 
     
    2525 
    2626  # Now we know the version. Get the svnversion.txt from the last update. 
    27   $filename = "../../$reldir"."$rver/$fw_ari-$vers.tgz"; 
     27  $filename = "../../$reldir"."$rver/$fw_langpacks-$vers.tgz"; 
    2828  print "CHECKING VERSION: ..... "; 
    2929  #print "CHECKING VERSION WITH: tar -zxOf $filename $moddir/svnversion.txt: ...  "; 
    3030  system("tar -zxOf ".$filename." ".$moddir."/svnversion.txt"); 
    31   print "Geting svn log since that version for $rver : .... \n\n"; 
    32   $svnver = system("svn log http://svn.freepbx.org/freepbx/branches/$rver/amp_conf/htdocs/recordings -r `tar -zxOf ".$filename." ".$moddir."/svnversion.txt | sed -e s/SVN\\\ VERSION://`:HEAD"); 
     31  print "Geting svn log of language updates since that version for $rver : .... \n\n"; 
     32  system("svn log http://svn.freepbx.org/freepbx/branches/$rver/amp_conf/htdocs/recordings/locale -v -r `tar -zxOf ".$filename." ".$moddir."/svnversion.txt | sed -e s/SVN\\\ VERSION://`:HEAD | grep 'htdocs/recordings/locale'"); 
     33  system("svn log http://svn.freepbx.org/freepbx/branches/$rver/amp_conf/htdocs/admin -v -r `tar -zxOf ".$filename." ".$moddir."/svnversion.txt | sed -e s/SVN\\\ VERSION://`:HEAD | grep 'i18n/' | grep 'htdocs/admin'"); 
     34  system("svn log http://svn.freepbx.org/modules/branches/$rver -v -r `tar -zxOf ".$filename." ".$moddir."/svnversion.txt | sed -e s/SVN\\\ VERSION://`:HEAD | grep 'i18n/' | grep 'modules/branches'"); 
    3335 
     36 
     37  # Test calls 
     38  # system("svn log http://svn.freepbx.org/freepbx/branches/$rver/amp_conf/htdocs/recordings/locale -v -r 4000:HEAD | grep 'htdocs/recordings/locale'"); 
     39  # system("svn log http://svn.freepbx.org/freepbx/branches/$rver/amp_conf/htdocs/admin -v -r 4000:HEAD | grep 'i18n/' | grep 'htdocs/admin'"); 
     40  # system("svn log http://svn.freepbx.org/modules/branches/$rver -v -r 4000:HEAD | grep 'i18n/' | grep 'modules/branches'"); 
  • modules/branches/2.5/publish.pl

    r6498 r6683  
    1212$fw_fop = "fw_fop"; 
    1313$fw_ari = "fw_ari"; 
     14$fw_langpacks = "fw_langpacks"; 
    1415 
    1516my $reldir = "release/"; 
     
    120121    if (system("rm -rf $fw_ari/htdocs_ari/includes/main.conf.php")) { 
    121122      die "FATAL: failed to trim main.conf.php ARI file\n"; 
     123    } 
     124 
     125  } 
     126  if ($moddir =~ /$fw_langpacks/) { 
     127 
     128    my $module_url="http://svn.freepbx.org/modules/branches/$rver"; 
     129    my $base_url="http://svn.freepbx.org/freepbx/$fwbranch/amp_conf/htdocs"; 
     130    my $framework_url="$base_url/admin"; 
     131    my $recordings_url="$base_url/recordings"; 
     132 
     133    @modules=`svn list $module_url | grep '/'`; 
     134 
     135    if (system("rm -rf $fw_langpacks/htdocs")) { 
     136      die "FATAL: failed to remove old htdocs dir\n"; 
     137    } 
     138    if (system("mkdir -p $fw_langpacks/htdocs/admin/modules")) { 
     139      die "FATAL: failed to create htdocs/admin/modules\n"; 
     140    } 
     141    if (system("mkdir -p $fw_langpacks/htdocs/recordings")) { 
     142      die "FATAL: failed to create htdocs/recordings\n"; 
     143    } 
     144 
     145    if (system("svn export $framework_url/i18n $fw_langpacks/htdocs/admin/i18n")) { 
     146      die "FATAL: failed to export $framework_url/i18n\n"; 
     147    } 
     148    if (system("svn export $recordings_url/locale $fw_langpacks/htdocs/recordings/locale")) { 
     149      die "FATAL: failed to export $recurdings_url/locale\n"; 
     150    } 
     151    foreach my $module ( @modules ) { 
     152      chomp($module); 
     153      if (system("rm -rf $fw_langpacks/i18n")) { 
     154        die "FATAL: failed to remove temp i18n dir\n"; 
     155      } 
     156      if (!system("svn export $module_url/$module"."i18n $fw_langpacks/i18n 2> /dev/null")) { 
     157        if (system("mkdir $fw_langpacks/htdocs/admin/modules/$module")) { 
     158          die "FATAL: failed to create htdocs/admin/modules/$module\n"; 
     159        } 
     160        if (system("mv $fw_langpacks/i18n $fw_langpacks/htdocs/admin/modules/$module")) { 
     161          die "FATAL: failed to move i18n to htdocs/admin/modules/$module\n"; 
     162        } 
     163      } else { 
     164        print "No i18n files for $module"."\n"; 
     165      } 
     166    } 
     167 
     168 
     169    # Create the svnversion information for this framework snapshot 
     170    # 
     171    if (system("echo SVN VERSION: `svn log -q -r HEAD http://svn.freepbx.org/ | cut -s -f 1 -d ' ' | cut -b '2-'` > $fw_langpacks/svnversion.txt")) { 
     172      die "FATAL: svnversion failed to create svnversion.txt\n"; 
    122173    } 
    123174 
     
    161212      next if ($x =~ /module.xml/); 
    162213      next if ($x =~ /htdocs_ari/); 
     214      next if ($x =~ /svnversion.txt/); 
     215      $files .= "$x "; 
     216  } elsif ($moddir =~ /$fw_langpacks/) { 
     217      next if ($x =~ /module.xml/); 
     218      next if ($x =~ /htdocs/); 
    163219      next if ($x =~ /svnversion.txt/); 
    164220      $files .= "$x ";