'; echo '
'; include('include/dbconn.php'); # $client = '1'; # $ip = '192.168.0.159'; # $op = 'calcdsfs'; $home = '/home/www-data'; # $update_alx_cmd = 'NOCOLORS=true # /usr/sbin/update-alx # --user tjoke # --pass strunz # --server-share //192.168.0.2/magetmp # --min-space 50000 # --mirrors http://192.168.0.2/magellan-050 # --rsync rsync://192.168.0.2/mage-cvs-alx # --profile alx-050'; # --proxy # --ftp-proxy # --http-proxy # --no-proxy'; ?> /dev/null && exit 0 || exit 1',$retval); if($retval==0) { if($op=="calc") { echo ' '.strtoupper('Fetching list of packages to upgrade on client #'.$client.' ('.$ip.')...
'); exec('/usr/bin/ssh -l root '.$ip.' /sbin/mageupgrade --calc-bash',$out,$err); echo '
';
				echo '';
				if (array_key_exists("0", $out))
				{
					foreach( $out as $i)
					{
						$item=explode(",",$i);
						$pcat=$item[0];
						$pname=$item[1];
						$opver=$item[2];
						$npver=$item[3];

						echo '';
						echo '';
					}
				}
				else echo 'No updates for client '.$client.' available.';			
				echo '
'; echo ''.$pcat.'/'.$pname.''; echo ''; echo ' [ '.$opver.' -> '.$npver.' ] '; echo '
'; echo '
'; } elseif($op=="update") { echo ' '.strtoupper('Fetching new mage database for client #'.$client.' ('.$ip.')...
'); echo '
'; echo '
'; system('/usr/bin/ssh -l root '.$ip.' "NOCOLORS=true /sbin/mage update"'); echo '
'; } elseif($op=="upgrade") { echo ' '.strtoupper('Running update-alx on client #'.$client.' ('.$ip.')...
'); echo '
'; echo '
'; echo 'forcing verbose=off
'; system('/usr/bin/ssh -l root '.$ip.' \'sed -i -e "s:^\\(VERBOSE=\\).*:\\1\\"off\\":" /etc/mage.rc\''); # check if /usr/sbin/update-alx exists, if not update mage-alx and alxconfig-alx first exec('/usr/bin/ssh -l root '.$ip.' "[ -x /usr/sbin/update-alx ] && exit 0 || exit 1"',$outarr,$err); if($err!=0) { echo '"/usr/sbin/update-alx" missing on client "'.$client.'". Updating mage-alx and alxconfig-ng-alx first ...
'; system('/usr/bin/ssh -l root '.$ip.' "NOCOLORS=true /sbin/mage install mage-alx"'); #system('/usr/bin/scp /var/www/localhost/htdocs/alx/he/update-alx root@'.$ip.':/usr/sbin'); system('/usr/bin/ssh -l root '.$ip.' "NOCOLORS=true /sbin/mage install alxconfig-ng-alx"'); } #system('/usr/bin/ssh -l root '.$ip.' "NOCOLORS=true /usr/sbin/update-alx --user tjoke --pass strunz --server-share //192.168.0.2/magetmp --min-space 50000 --mirrors http://192.168.0.2/alx-050 --rsync rsync://192.168.0.2/mage-cvs-alx --profile alx-050"'); system('/usr/bin/ssh -l root '.$ip.' "NOCOLORS=true /usr/sbin/update-alx"'); echo '
'; } else echo 'unkown operation'; } else echo ' '.strtoupper('Client not online, try again later...
'); } echo '
'; ?>