Changeset 12600

Show
Ignore:
Timestamp:
09/30/07 14:20:01 (1 year ago)
Author:
tarjei
Message:

Backport 12599. Closes #153.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/build/packageMidCOMcore.php

    r12583 r12600  
    11<?php 
    2  
    3  
    42/** 
    53 * Created on 10/09/2006 
     
    86 * @copyright The Midgard Project, http://www.midgard-project.org 
    97 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License 
     8 * 
     9 * Package midcom core as a pear package 
    1010 *  
    1111 */ 
     
    7575 
    7676    // todo: add a setVersion from the commandline 
    77         protected $copyfiles = array (); 
     77    protected $copyfiles = array (); 
     78    /* array of files in the static dir. */ 
     79    protected $staticFiles ; 
    7880 
    7981        /** 
     
    9799            'packagedirectory' => $this->path, 
    98100            'baseinstalldir' => 'midcom/lib', 
     101            'installexceptions' => array( 'support' => '/'), 
     102            'dir_roles' => array(),  
    99103            'simpleoutput' => true, 
    100                                     'include' => array('*'), 
     104                                    'ignore' => array('package-template.xml'), 
     105                                    'include' => array('*.php', 'midcom*', 'support*'), 
    101106            ); 
    102107           
     
    118123        $package->generateContents(); 
    119124 
     125        $this->addStatic($package); 
     126 
    120127        if ($package->debugPackageFile()) { 
    121128            echo "Writing package.....\n"; 
     
    128135    protected function getNotes($package) { 
    129136        // todo add release notes... 
     137    } 
     138    /* 
     139     * This method builds the list of files in the static dir and adds them to the  
     140     * */ 
     141    protected function addStatic($package)  
     142    { 
     143 
     144        $this->staticFiles = array(); 
     145        $this->getDirFilesRecursive($this->path . "/static"); 
     146        foreach ($this->staticFiles as $path => $files )  
     147        { 
     148            $fpath = str_replace($this->path . '/static/', "", $path); 
     149            foreach ($files as $filename)  
     150            { 
     151                $dir = '/static'; 
     152                $filen =  $fpath .'/' . $filename ; 
     153                $package->addFile($dir, $filen , array( 
     154                            'role' => 'web',  
     155                            'baseinstalldir' => '/',  
     156                            'install-as' => $fpath ."/". $filename ) ); 
     157            } 
     158        } 
     159 
     160    } 
     161 
     162    protected function getDirFilesRecursive($path) { 
     163        $list = dir($path); 
     164        while (($file = $list->read()) !== FALSE) { 
     165            if ($file{0} == '.') continue; // skipp .svn , . and .. 
     166            if (is_dir($path .'/'.$file)) { 
     167                $this->getDirFilesRecursive($path .'/' . $file); 
     168            } else { 
     169                if (!isset($this->staticFiles[$path])) $this->staticFiles[$path] = array(); 
     170                $this->staticFiles[$path][] = $file; 
     171            } 
     172        } 
     173        $list->close(); 
    130174    } 
    131175