Grav\Plugin\Admin\Gpm::GPM PHP Method

GPM() public static method

public static GPM ( )
    public static function GPM()
    {
        if (!static::$GPM) {
            static::$GPM = new GravGPM();
        }
        return static::$GPM;
    }

Usage Example

 /**
  * Handles updating Grav
  *
  * @return bool True if the action was performed
  */
 public function taskUpdategrav()
 {
     if (!$this->authorizeTask('install grav', ['admin.super'])) {
         return false;
     }
     $gpm = Gpm::GPM();
     $version = $gpm->grav->getVersion();
     $result = Gpm::selfupgrade();
     if ($result) {
         $this->admin->json_response = ['status' => 'success', 'type' => 'updategrav', 'version' => $version, 'message' => $this->admin->translate('PLUGIN_ADMIN.GRAV_WAS_SUCCESSFULLY_UPDATED_TO') . ' ' . $version];
     } else {
         $this->admin->json_response = ['status' => 'error', 'type' => 'updategrav', 'version' => GRAV_VERSION, 'message' => $this->admin->translate('PLUGIN_ADMIN.GRAV_UPDATE_FAILED') . ' <br>' . Installer::lastErrorMsg()];
     }
     return true;
 }