Marius Cramer
2013-11-14 7fe908c50c8dbc5cc05f571dbe11d66141caacd4
server/lib/classes/aps_installer.inc.php
@@ -27,7 +27,7 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('aps_base.inc.php');
require_once 'aps_base.inc.php';
@set_time_limit(0);
@ignore_user_abort(1);
@@ -52,10 +52,14 @@
    * @param $app the application instance (db handle + log method)
    * @param $interface_mode act in interface (true) or server mode (false)
    */
    public function __construct($app, $interface_mode = false)
    {
        parent::__construct($app, 'APS installer: ', $interface_mode);
    }
    
    /**
     * Before the cron is executed, make sure all necessary options are set
@@ -75,12 +79,15 @@
            
            return true;
        }
        catch(Exception $e)
        {
            $app->log('Aborting execution because '.$e->getMessage(), 1);
            return false;
        }
    }
    
    /**
     * Get a file from a ZIP archive and either return it's content or
@@ -127,6 +134,7 @@
            $zip->close();
            
        }
        catch(Exception $e)
        {
            // The exception message is only interesting for debugging reasons
@@ -134,6 +142,8 @@
            return false;
        }
    }    
    
    /**
     * Extract the complete directory of a ZIP file
@@ -236,6 +246,8 @@
        }
    }    
    
    /**
     * Setup the environment with data for the install location
     * 
@@ -280,6 +292,8 @@
        $this->putenv[] = 'BASE_URL_HOST='.$this->domain;
        $this->putenv[] = 'BASE_URL_PATH='.$this->sublocation.'/';
    }    
    
    /**
     * Setup a database (if needed) and the appropriate environment variables
@@ -365,6 +379,8 @@
        $this->putenv[] = 'DB_'.$db_id.'_PORT=3306';
        $this->putenv[] = 'DB_'.$db_id.'_VERSION='.$mysqlver;
    }    
    
    /**
     * Extract all needed files from the package
@@ -463,6 +479,8 @@
        return true;
    }
    
    /**
     * Get all user config variables and set them to environment variables
     * 
@@ -490,6 +508,8 @@
            $this->putenv[] = 'SETTINGS_'.$data['name'].'='.$data['value'];
        }
    }
   
   /**
     * Fetch binary data from a given array
@@ -536,6 +556,8 @@
        }
        curl_multi_close($mh);
    }
    
    /**
     * The installation script should be executed
@@ -593,6 +615,7 @@
                    WHERE id = "'.$app->db->quote($task['instance_id']).'";');
            }
        }
        catch(Exception $e)
        {
            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
@@ -603,6 +626,8 @@
        
        return true;
    }
    
    /**
     * Cleanup: Remove install scripts, remove tasks and update the database
@@ -615,6 +640,8 @@
        chdir($this->local_installpath);
        exec("rm -Rf ".escapeshellarg($this->local_installpath).'install_scripts');
    }    
    
    /**
     * The main method which performs the actual package installation
@@ -716,5 +743,7 @@
        
        unset($sxe);
    }
}
?>