@@ -395,7 +395,7 @@ private function prepareFiles($task, $sxe)
395395 mkdir ($ this ->document_root , 0777 , true );
396396 }
397397 } else {
398- exec ("rm -Rf " . escapeshellarg ( $ this ->local_installpath ). ' * ' );
398+ $ app -> system -> exec_safe ("rm -Rf ?* " , $ this ->local_installpath );
399399 }
400400 } else {
401401 mkdir ($ this ->local_installpath , 0777 , true );
@@ -412,7 +412,7 @@ private function prepareFiles($task, $sxe)
412412 || ($ this ->extractZip ($ this ->packages_dir .'/ ' .$ task ['path ' ], 'scripts ' , $ this ->local_installpath .'install_scripts/ ' ) === false ) )
413413 {
414414 // Clean already extracted data
415- exec ("rm -Rf " . escapeshellarg ( $ this ->local_installpath ). ' * ' );
415+ $ app -> system -> exec_safe ("rm -Rf ?* " , $ this ->local_installpath );
416416 throw new Exception ('Unable to extract the package ' .$ task ['path ' ]);
417417 }
418418
@@ -423,11 +423,11 @@ private function prepareFiles($task, $sxe)
423423 $ owner_res = $ app ->db ->queryOneRecord ("SELECT system_user, system_group FROM web_domain WHERE domain = ? " , $ main_domain ['value ' ]);
424424 $ this ->file_owner_user = $ owner_res ['system_user ' ];
425425 $ this ->file_owner_group = $ owner_res ['system_group ' ];
426- exec ('chown -R ' . $ this ->file_owner_user . ' : ' . $ this ->file_owner_group . ' ' . escapeshellarg ( $ this ->local_installpath ) );
426+ $ app -> system -> exec_safe ('chown -R ?:? ? ' , $ this ->file_owner_user , $ this ->file_owner_group , $ this ->local_installpath );
427427
428428 //* Chown stats directory back
429429 if (is_dir ($ this ->local_installpath .'stats ' )) {
430- exec ('chown -R root:root ' . escapeshellarg ( $ this ->local_installpath .'stats ' ) );
430+ $ app -> system -> exec_safe ('chown -R root:root ? ' , $ this ->local_installpath .'stats ' );
431431 }
432432 }
433433 }
@@ -554,7 +554,9 @@ private function doInstallation($task, $sxe)
554554
555555 $ shell_retcode = true ;
556556 $ shell_ret = array ();
557- exec ('php ' .escapeshellarg ($ this ->local_installpath .'install_scripts/ ' .$ cfgscript ).' install 2>&1 ' , $ shell_ret , $ shell_retcode );
557+ $ app ->system ->exec_safe ('php ? install 2>&1 ' , $ this ->local_installpath .'install_scripts/ ' .$ cfgscript );
558+ $ shell_ret = $ app ->system ->last_exec_out ();
559+ $ shell_retcode = $ app ->system ->last_exec_retcode ();
558560 $ shell_ret = array_filter ($ shell_ret );
559561 $ shell_ret_str = implode ("\n" , $ shell_ret );
560562
@@ -566,11 +568,11 @@ private function doInstallation($task, $sxe)
566568 else
567569 {
568570 // The install succeeded, chown newly created files too
569- exec ('chown -R ' . $ this ->file_owner_user . ' : ' . $ this ->file_owner_group . ' ' . escapeshellarg ( $ this ->local_installpath ) );
571+ $ app -> system -> exec_safe ('chown -R ?:? ? ' , $ this ->file_owner_user , $ this ->file_owner_group , $ this ->local_installpath );
570572
571573 //* Chown stats directory back
572574 if (is_dir ($ this ->local_installpath .'stats ' )) {
573- exec ('chown -R root:root ' . escapeshellarg ( $ this ->local_installpath .'stats ' ) );
575+ $ app -> system -> exec_safe ('chown -R root:root ? ' , $ this ->local_installpath .'stats ' );
574576 }
575577
576578 $ app ->dbmaster ->query ('UPDATE aps_instances SET instance_status = ? WHERE id = ? ' , INSTANCE_SUCCESS , $ task ['instance_id ' ]);
@@ -597,8 +599,9 @@ private function doInstallation($task, $sxe)
597599 */
598600 private function cleanup ($ task , $ sxe )
599601 {
602+ global $ app ;
600603 chdir ($ this ->local_installpath );
601- exec ("rm -Rf " . escapeshellarg ( $ this ->local_installpath ) .'install_scripts ' );
604+ $ app -> system -> exec_safe ("rm -Rf ? " , $ this ->local_installpath .'install_scripts ' );
602605 }
603606
604607
0 commit comments