3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class contains functions for managing extensions
21 class CRM_Core_BAO_Extension
extends CRM_Core_DAO_Extension
{
24 * Retrieve DB object and copy to defaults array.
26 * @param array $params
27 * Array of criteria values.
28 * @param array $defaults
29 * Array to be populated with found values.
32 * The DAO object, if found.
36 public static function retrieve($params, &$defaults) {
37 return self
::commonRetrieve(self
::class, $params, $defaults);
41 * Delete an extension.
44 * Id of the extension to be deleted.
48 public static function del($id) {
49 $extension = new CRM_Core_DAO_Extension();
51 return $extension->delete();
55 * Change the schema version of an extension.
57 * @param string $fullName
58 * the fully-qualified name (eg "com.example.myextension").
59 * @param string $schemaVersion
61 * @return \CRM_Core_DAO|object
63 public static function setSchemaVersion($fullName, $schemaVersion) {
64 $sql = 'UPDATE civicrm_extension SET schema_version = %1 WHERE full_name = %2';
66 1 => [$schemaVersion, 'String'],
67 2 => [$fullName, 'String'],
69 return CRM_Core_DAO
::executeQuery($sql, $params);
73 * Determine the schema version of an extension.
75 * @param string $fullName
76 * the fully-qualified name (eg "com.example.myextension").
79 public static function getSchemaVersion($fullName) {
80 $sql = 'SELECT schema_version FROM civicrm_extension WHERE full_name = %1';
82 1 => [$fullName, 'String'],
84 return CRM_Core_DAO
::singleValueQuery($sql, $params);