-
-
Save rginnow/576982b79a032e6e4aa6 to your computer and use it in GitHub Desktop.
Revisions
-
rginnow revised this gist
Sep 8, 2015 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,8 +61,8 @@ function usage() //initialize if(!defined('sugarEntry')) define('sugarEntry', true); require($sugar_directory.'/config.php'); require($sugar_directory.'/config_override.php'); require_once($sugar_directory.'/include/entryPoint.php'); require_once($sugar_directory.'/ModuleInstall/PackageManager/PackageManager.php'); $current_user = new User(); $current_user->retrieve("1"); // get the admin user, just in case @@ -73,9 +73,6 @@ function usage() $modInstaller = new PackageManager(); $modInstaller->silent = true; //shuts up the javscript progress bar // Squelch some warnings $GLOBALS[ 'app_list_strings' ][ 'moduleList' ] = Array(); -
rginnow revised this gist
Sep 8, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,10 +74,10 @@ function usage() $modInstaller->silent = true; //shuts up the javscript progress bar // disable packageScanner $sugar_config['moduleInstaller']['packageScan'] = false; // Squelch some warnings $GLOBALS[ 'app_list_strings' ][ 'moduleList' ] = Array(); // Check for already installed $new_upgrade = new UpgradeHistory(); -
rginnow renamed this gist
Sep 4, 2015 . 1 changed file with 9 additions and 25 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/usr/local/bin php <?php function usage() @@ -63,18 +63,21 @@ function usage() require($sugar_directory.'/config.php'); require_once($sugar_directory.'/include/entryPoint.php'); require_once($sugar_directory.'/ModuleInstall/ModuleInstaller.php'); require_once($sugar_directory.'/ModuleInstall/PackageManager/PackageManager.php'); $current_user = new User(); $current_user->retrieve("1"); // get the admin user, just in case $current_user->is_admin = '1'; //initialize the module installer // Use PackageManager instead of ModuleInstaller for extra pre-checks $modInstaller = new PackageManager(); $modInstaller->silent = true; //shuts up the javscript progress bar // disable packageScanner //$sugar_config['moduleInstaller']['packageScan'] = false; // Squelch some warnings //$GLOBALS[ 'app_list_strings' ][ 'moduleList' ] = Array(); // Check for already installed $new_upgrade = new UpgradeHistory(); @@ -86,26 +89,7 @@ function usage() //start installation echo "Patching $sugar_directory\n"; $modInstaller->performInstall($zip_file); echo "Success!\n"; exit(0); -
jmertic created this gist
Aug 21, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,111 @@ #!/usr/bin/env php <?php function usage() { print("usage: -i /path/to/instance -p /path/to/expanded/module -z /path/to/zipfile\n"); exit(1); } $opts = getopt('i:p:z:'); if (!$opts) usage(); $sugar_directory = array_key_exists('i', $opts) ? $opts['i'] : false; $package_dir = array_key_exists('p', $opts) ? $opts['p'] : false; $zip_file = array_key_exists('z', $opts) ? $opts['z'] : false; if (!$sugar_directory || !$package_dir || !$zip_file) { usage(); } if ( function_exists('posix_getpwuid') ) { $euinfo = posix_getpwuid(posix_geteuid()); $euser = $euinfo['name']; $auser = exec("echo $(ps axho user,comm|grep -E \"httpd|apache\"|uniq|grep -v \"root\"|awk 'END {if ($1) print $1}')"); if ($euser != $auser ) { error_log("Must be run as $auser! [not: $euser]"); usage(); } } if (!is_dir($package_dir)) { error_log("Package directory isn't a directory"); exit(1); } if (!is_readable($zip_file)) { error_log("Can't read zip file at $zip_file"); exit(1); } if (!chdir($sugar_directory)) { error_log("Failed to chdir to $sugar_directory"); exit(1); } if (!is_readable($package_dir . '/manifest.php')) { error_log("Package dir does not contain a readable manifest.php\n"); exit(1); } require_once($package_dir . '/manifest.php'); if (!is_array($manifest)) { error_log("Sourced manifest but \$manifest was not set!\n"); exit(1); } if (!array_key_exists('name', $manifest) || $manifest['name'] == '') { error_log("manifest doesn't specify a name!\n"); exit(1); } //initialize if(!defined('sugarEntry')) define('sugarEntry', true); require($sugar_directory.'/config.php'); require_once($sugar_directory.'/include/entryPoint.php'); require_once($sugar_directory.'/ModuleInstall/ModuleInstaller.php'); $current_user = new User(); $current_user->is_admin = '1'; //initialize the module installer $modInstaller = new ModuleInstaller(); $modInstaller->silent = true; //shuts up the javscript progress bar // disable packageScanner $sugar_config['moduleInstaller']['packageScan'] = false; // Squelch some warnings $GLOBALS[ 'app_list_strings' ][ 'moduleList' ] = Array(); // Check for already installed $new_upgrade = new UpgradeHistory(); $new_upgrade->name = $manifest['name']; if ($new_upgrade->checkForExisting($new_upgrade) !== null) { error_log("Already installed.\n"); exit(0); } //start installation echo "Patching $sugar_directory\n"; $modInstaller->install($package_dir); $to_serialize = array( 'manifest' => $manifest, 'installdefs' => isset($installdefs) ? $installdefs : Array(), 'upgrade_manifest' => isset($upgrade_manifest) ? $upgrade_manifest : Array(), ); echo "Adding UpgradeHistory object\n"; $new_upgrade->name = $manifest['name']; $new_upgrade->filename = $package_dir; $new_upgrade->md5sum = md5_file($zip_file); $new_upgrade->type = array_key_exists('type', $manifest) ? $manifest['type'] : 'module'; $new_upgrade->version = array_key_exists('version', $manifest) ? $manifest['version'] : ''; $new_upgrade->status = "installed"; $new_upgrade->author = array_key_exists('author', $manifest) ? $manifest['author'] : ''; $new_upgrade->description = array_key_exists('description', $manifest) ? $manifest['description'] : ''; $new_upgrade->id_name = array_key_exists('id', $installdefs) ? $installdefs['id'] : ''; $new_upgrade->manifest = base64_encode(serialize($to_serialize)); $new_upgrade->save(); echo "Success!\n"; exit(0);