Skip to content
Snippets Groups Projects
Select Git revision
  • 829a00f82d33c47200eac8aa1abaed43826c39a1
  • main default protected
  • v0.1
3 results

amcli.php

Blame
  • inc_functions.php 28.85 KiB
    <?php
    
    /* ######################################################################
    
      IML DEPLOYMENT
    
      included functions for the act_*.php files
    
      ---------------------------------------------------------------------
      2013-11-08  Axel <axel.hahn@iml.unibe.ch>
      ###################################################################### */
    
    global $aParams;
    $aParams = array();
    
    
    // ----------------------------------------------------------------------
    // verifiy config
    // ----------------------------------------------------------------------
    /*
        $aErrors=array();
        if (!isset($aConfig) || !is_array($aConfig)) {
            $aErrors[]="* \$aConfig does not exist. The config was not included before including " . __FILE__ . " in the request/ script.\n";
        } else {
    
            foreach (array(
                'appRootDir', 
                'configDir', 
                'workDir',
                'dataDir',
                'buildDir',
                'buildDefaultsDir',
                'packageDir',
                'archiveDir',
                ) as $sKey){
                if (!is_dir($aConfig[$sKey])){
                    $aErrors[]="* \$aConfig['$sKey'] points to a non existing directory (".$aConfig[$sKey].").\n";
                } else {
                    if (!is_writable($aConfig[$sKey])){
                        $aErrors[]="* \$aConfig['$sKey'] = ".$aConfig[$sKey]." is NOT writable.\n";
                    }
                }
            }
        }
        foreach (array(
            $aConfig['dataDir'].'/database', 
            $aConfig['dataDir'].'/projects', 
            $aConfig['dataDir'].'/sshkeys', 
            ) as $sDir2Check){
            if (!is_dir($sDir2Check)){
                $aErrors[]="* directory not found: $sDir2Check\n";
            } else {
                if (!is_writable($sDir2Check)){
                    $aErrors[]="* $sDir2Check is NOT writable.\n";
                }
            }
        }
    
        // check required keys in the config
        foreach (array(
            'auth',
            'hooks',
            'installPackages',
            'lang',
            'phases',
            'projects',
        ) as $sKey){
            if (!array_key_exists($sKey, $aConfig)){
                $aErrors[]="* missing key directory [$sKey] in config\n";
            }