mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:29:03 -05:00 
			
		
		
		
	Fix regression where .env file was being deleted erroneously (#3515)
* Fixes for tests * Fixes for self updates
This commit is contained in:
		
							parent
							
								
									54f3701cd5
								
							
						
					
					
						commit
						c8e3c7ae68
					
				@ -41,16 +41,6 @@ class ArtisanUpgrade extends Command
 | 
				
			|||||||
    public function handle()
 | 
					    public function handle()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        set_time_limit(0);
 | 
					        set_time_limit(0);
 | 
				
			||||||
        // Composer\Factory::getHomeDir() method
 | 
					 | 
				
			||||||
        // needs COMPOSER_HOME environment variable set
 | 
					 | 
				
			||||||
        putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // call `composer install` command programmatically
 | 
					 | 
				
			||||||
        $input = new ArrayInput(array('command' => 'install'));
 | 
					 | 
				
			||||||
        $application = new Application();
 | 
					 | 
				
			||||||
        //$application->setAutoExit(false); // prevent `$application->run` method from exitting the script
 | 
					 | 
				
			||||||
        $application->run($input);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            Artisan::call('migrate');
 | 
					            Artisan::call('migrate');
 | 
				
			||||||
@ -69,5 +59,13 @@ class ArtisanUpgrade extends Command
 | 
				
			|||||||
        } catch (Exception $e) {
 | 
					        } catch (Exception $e) {
 | 
				
			||||||
            \Log::error("I wasn't able to restart the queue");
 | 
					            \Log::error("I wasn't able to restart the queue");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
 | 
				
			||||||
 | 
					        $input = new ArrayInput(array('command' => 'install'));
 | 
				
			||||||
 | 
					        $application = new Application();
 | 
				
			||||||
 | 
					        //$application->setAutoExit(false); // prevent `$application->run` method from exitting the script
 | 
				
			||||||
 | 
					        $application->run($input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -196,7 +196,7 @@ class CompanyGateway extends BaseModel
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function getPublishableKey() :string
 | 
					    public function getPublishableKey() :string
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->getConfigField('publishable_key');
 | 
					        return $this->getConfigField('publishableKey');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,7 @@ class StripePaymentDriver extends BasePaymentDriver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function init() :void
 | 
					    public function init() :void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Stripe::setApiKey($this->company_gateway->getConfigField('23_apiKey'));
 | 
					        Stripe::setApiKey($this->company_gateway->getConfigField('apiKey'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -64,7 +64,7 @@ class Ninja
 | 
				
			|||||||
        $data = trim(CurlUtils::post('https://license.invoiceninja.com/api/check', $data));
 | 
					        $data = trim(CurlUtils::post('https://license.invoiceninja.com/api/check', $data));
 | 
				
			||||||
        $data = json_decode($data);
 | 
					        $data = json_decode($data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($data->message == sha1(config('ninja.license'))) {
 | 
					        if ($data && property_exists($data, 'message') && $data->message == sha1(config('ninja.license'))) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,6 @@ class SystemHealth
 | 
				
			|||||||
            'dbs' => self::dbCheck(),
 | 
					            'dbs' => self::dbCheck(),
 | 
				
			||||||
            'mail' => self::testMailServer(),
 | 
					            'mail' => self::testMailServer(),
 | 
				
			||||||
            'env_writable' => self::checkEnvWritable(),
 | 
					            'env_writable' => self::checkEnvWritable(),
 | 
				
			||||||
            'env_exists'
 | 
					 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -122,6 +121,7 @@ class SystemHealth
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private static function checkEnvWritable()
 | 
					    private static function checkEnvWritable()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return @fopen(base_path().'/.env', 'w');
 | 
					        return is_writable(base_path().'/.env');
 | 
				
			||||||
 | 
					        //return @fopen(base_path().'/.env', 'w');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user