mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Logging enabled. And fix on Excludes.
This commit is contained in:
		
							parent
							
								
									8ed0154749
								
							
						
					
					
						commit
						67ca7b1e21
					
				@ -1,10 +1,11 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
class Mage_Console
 | 
					class Mage_Console
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private $_args;
 | 
					    private $_args = null;
 | 
				
			||||||
    private $_action;
 | 
					    private $_action = null;
 | 
				
			||||||
    private $_actionOptions;
 | 
					    private $_actionOptions = null;
 | 
				
			||||||
    private $_environment;
 | 
					    private $_environment = null;
 | 
				
			||||||
 | 
					    private static $_log = null;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function setArgs($args)
 | 
					    public function setArgs($args)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -46,6 +47,8 @@ class Mage_Console
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    public static function output($message, $tabs = 1, $newLine = 1)
 | 
					    public static function output($message, $tabs = 1, $newLine = 1)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        self::log(strip_tags($message));
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        $output = str_repeat("\t", $tabs)
 | 
					        $output = str_repeat("\t", $tabs)
 | 
				
			||||||
                . Mage_Console_Colors::color($message)
 | 
					                . Mage_Console_Colors::color($message)
 | 
				
			||||||
                . str_repeat(PHP_EOL, $newLine);
 | 
					                . str_repeat(PHP_EOL, $newLine);
 | 
				
			||||||
@ -55,10 +58,16 @@ class Mage_Console
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    public static function executeCommand($command)
 | 
					    public static function executeCommand($command)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        self::log('---------------------------------');
 | 
				
			||||||
 | 
					        self::log('---- Executing: $ ' . $command);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        ob_start();
 | 
					        ob_start();
 | 
				
			||||||
        system($command . ' 2>&1', $return);
 | 
					        system($command . ' 2>&1', $return);
 | 
				
			||||||
        $log = ob_get_clean();
 | 
					        $log = ob_get_clean();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        self::log($log);
 | 
				
			||||||
 | 
					        self::log('---------------------------------');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return !$return;
 | 
					        return !$return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -94,4 +103,14 @@ class Mage_Console
 | 
				
			|||||||
                break;
 | 
					                break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static function log($message, $continuation = false)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (self::$_log == null) {
 | 
				
			||||||
 | 
					            self::$_log = fopen('.mage/logs/log-' . date('Ymd-His') . '.log', 'w');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $message = date('Y-m-d H:i:s -- ') . $message;
 | 
				
			||||||
 | 
					        fwrite(self::$_log, $message . PHP_EOL);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -24,7 +24,7 @@ class Mage_Task_BuiltIn_Deployment_Rsync
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $command = 'rsync -avz '
 | 
					        $command = 'rsync -avz '
 | 
				
			||||||
                 . $this->_excludes($excludes + $userExcludes) . ' '
 | 
					                 . $this->_excludes(array_merge($excludes, $userExcludes)) . ' '
 | 
				
			||||||
                 . $this->_config['deploy']['deploy-from'] . ' '
 | 
					                 . $this->_config['deploy']['deploy-from'] . ' '
 | 
				
			||||||
                 . $this->_config['deploy']['user'] . '@' . $this->_config['deploy']['host'] . ':' . $this->_config['deploy']['deploy-to'];
 | 
					                 . $this->_config['deploy']['user'] . '@' . $this->_config['deploy']['host'] . ':' . $this->_config['deploy']['deploy-to'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
# mage add environment production
 | 
					# mage add environment production
 | 
				
			||||||
# mage deploy to:production
 | 
					# mage deploy to:production
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					date_default_timezone_set('UTC');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$baseDir = dirname(dirname(__FILE__));
 | 
					$baseDir = dirname(dirname(__FILE__));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user