0byt3m1n1
Path:
/
data
/
applications
/
aps
/
mantis
/
1.2.7-0
/
standard
/
scripts
/
[
Home
]
File: upgrade-app.php
<?php require_once('app-util.php'); require_once('file-util.php'); function copyr($source, $dest){ // Simple copy for a file if (is_file($source)) { $c = copy($source, $dest); return $c; } // Make destination directory if (!is_dir($dest)) { $oldumask = umask(0); mkdir($dest, 0755); umask($oldumask); } // Loop through the folder $dir = dir($source); while (false !== $entry = $dir->read()) { // Skip pointers if ($entry == "." || $entry == "..") { continue; } // Deep copy directories if ($dest !== "$source/$entry") { echo "<br/>$source/$entry<br/>"; copyr("$source/$entry", "$dest/$entry"); } } // Clean up $dir->close(); return true; } function upgrade_app($from_ver, $from_rel, $config_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash){ // $upgrade_schema_files = get_upgrade_schema_files($argv[2], $argv[3]); $upgrade_schema_files = array(); if (file_exists($psa_modify_hash["@@"."ROOT_DIR"."@@"]."/config_inc.php")) { rename($psa_modify_hash["@@"."ROOT_DIR"."@@"]."/config_inc.php", $psa_modify_hash["@@"."ROOT_DIR"."@@"]."/conf".time().".php.bak"); } configure($config_files, $upgrade_schema_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash); $url = $psa_modify_hash["@@ROOT_URL@@"].'/admin/install.php'; $ch = curl_init(); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable $post_data = array(); $post_data['install'] = "2"; $post_data['hostname'] = get_db_address($db_ids[0]); $post_data['db_type'] = get_db_type($db_ids[0]); $post_data['database_name'] = get_db_name($db_ids[0]); $post_data['db_username'] = get_db_login($db_ids[0]); $post_data['db_password'] = get_db_password($db_ids[0]); $post_data['db_exists'] = "true"; $o=""; foreach ($post_data as $k=>$v) { $o.= "$k=".utf8_encode($v)."&"; } $post_data=substr($o,0,-1); echo '------'.$post_data.'--------'; curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $result = curl_exec($ch); // run the whole process if ($result === false) { echo "error: ".curl_error($ch); curl_close($ch); return 1; } curl_close($ch); rmdirr($psa_modify_hash["@@ROOT_DIR@@"].'/admin'); return 0; } ?>