| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace ModulesGarden\ProxmoxAddon\App\Configuration\Addon\Update;
- use ModulesGarden\ProxmoxAddon\Core\ModuleConstants;
- use Illuminate\Database\Capsule\Manager as DB;
- class AddonUpgradeService
- {
- public function getVersion(){
- if (!file_exists(ModuleConstants::getModuleRootDir() . DIRECTORY_SEPARATOR . 'moduleVersion.php'))
- {
- return;
- }
- include ModuleConstants::getModuleRootDir() . DS . 'moduleVersion.php';
- return $moduleVersion;
- }
- public function getDatabaseVersion(){
- return DB::table("tbladdonmodules")->where("module","proxmoxAddon")->where("setting","version")->value("value");
- }
- public function run(){
- $version = $this->getVersion();
- if($version && $this->getDatabaseVersion() != $version ){
- if(!function_exists('proxmoxAddon_upgrade')){
- require_once ModuleConstants::getFullPath() . DIRECTORY_SEPARATOR . "proxmoxAddon.php";
- }
- if(function_exists('proxmoxAddon_upgrade')){
- \proxmoxAddon_upgrade([
- "module"=> "proxmoxAddon",
- "modulelink" => "addonmodules.php?module=proxmoxAddon",
- "version"=> $version,
- "access" => 1
- ]);
- }
- }
- }
- }
|