phpDocumentor GalleryCore
Classes
[ class tree: GalleryCore ] [ index: GalleryCore ] [ all elements ]

Class: GalleryRepository

Source Location: /modules/core/classes/GalleryRepository.class

Class GalleryRepository

Property Summary
RepositoryIndex   $_index   Local repository index.
string   $_source   The source of this index (released, experimental, community)
GalleryRepositoryUtilities   $_utilities   Repository utilities.

[ Top ]
Method Summary
static void   clearRepositoryCache()   Clear the cached version of the repositories saved by a call to getRepositories()
static array   getRepositories()   Return a set of all the repositories that are currently active. The error count indicates the number of repositories that failed to initialize for some reason (perhaps from a malformed local copy of the index). The fix for this is to download a new version of the repository.
static array   translateRepositoryName()   Translate the repository tag to its localized name
boolean   comparePluginListEntries()   Compares two plugin list entries.
boolean   createPluginsDirectory()   Checks if the plugins directory exists and creates a subdirectory for each plugin type.
array   downloadAndUnpack()   Downloads a file from the repository.
array   downloadAndUnpackPackages()   Retrieve all the specified files as one http request and separate into individual packages.
void   downloadIndex()  
void   downloadPackagesForPlugin()   Download the specified packages.
array   getAllUpgradeablePackages()   Creates a list of all upgradeable packages.
array   getDownloadFileList()   Creates a list of URLs that
void   getIndexMetaData()  
void   getLanguagePackageFiles()  
void   getPackageVersionAndBuild()  
void   getPluginName()  
array   getPluginUpgradeInfo()   Determines which packages of the specified plugin are newer in the repository.
array   getRepositoryPluginList()   Returns a list of plugins of the specified type.
GalleryStatus   init()   Initializes the repository index and utilities.
array   isCoreUpgradeAvailable()   Determines whether a core module upgrade is available.
void   localIndexExists()  
void   pluginExistsInIndex()  
array   preVerifyPackage()   Verify that a package will install cleanly by examining all of its paths and making sure that any file operations that we intend to make will be successful.
void   removeObsoleteFiles()   Remove obsolete files when a plugin is updated.
GalleryStatus   scanPlugin()   Scan one plugin and update its entries in the GalleryPluginPackageMap.
void   updatePackageMetaData()  
GalleryStatus   verifyPackageIntegrity()   Verifies the integrity of the specified packages' unpacked files.
array   _preverifyAggregatePackages()   Preverify that we will have no trouble unpacking and writing the packages we downloaded

[ Top ]
Properties
RepositoryIndex   $_index [line 50]

Local repository index.

API Tags:
Access:  private


[ Top ]
string   $_source [line 57]

The source of this index (released, experimental, community)

API Tags:
Access:  private


[ Top ]
GalleryRepositoryUtilities   $_utilities [line 43]

Repository utilities.

API Tags:
Access:  private


[ Top ]
Methods
static method clearRepositoryCache  [line 114]

  static void clearRepositoryCache( [ $sources = array()], [ $repositoryClassName = 'GalleryRepository']  )

Clear the cached version of the repositories saved by a call to getRepositories()

Parameters:
   $sources: 
   $repositoryClassName: 


[ Top ]
static method getRepositories  [line 74]

  static array getRepositories( [array $sources = array()], [string $repositoryClassName = 'GalleryRepository']  )

Return a set of all the repositories that are currently active. The error count indicates the number of repositories that failed to initialize for some reason (perhaps from a malformed local copy of the index). The fix for this is to download a new version of the repository.

Parameters:
array   $sources:  (optional) an array of source names, eg 'official', 'community' If this is left empty, use the value stored in core.repositories.
string   $repositoryClassName:  (optional) the name of the repository class to use. should be GalleryRepository, except for test code.

API Tags:
Return:  GalleryStatus a status code array repository name => GalleryRepository the repository int error count (repositories that failed to load for some reason)


[ Top ]
static method translateRepositoryName  [line 874]

  static array translateRepositoryName( mixed $source  )

Translate the repository tag to its localized name


API Tags:
Return:  GalleryStatus a status code string the localized name

Information Tags:
Public:  

[ Top ]
comparePluginListEntries  [line 415]

  boolean comparePluginListEntries( array $plugin1, array $plugin2  )

Compares two plugin list entries.

A plugin list entry is an element of the array returned by getRepositoryPluginList. This is a callback for sorting the plugin list by (group label, plugin name).

Parameters:
array   $plugin1:  first plugin list entry
array   $plugin2:  second plugin list entry

API Tags:
Return:  see strcmp()


[ Top ]
createPluginsDirectory  [line 501]

  boolean createPluginsDirectory( )

Checks if the plugins directory exists and creates a subdirectory for each plugin type.


API Tags:
Return:  indicates whether the plugins directory is correctly set up string user-friendly error message

Information Tags:
Todo:  Delete on the next major API bump as it is not referenced.

[ Top ]
downloadAndUnpack  [line 584]

  array downloadAndUnpack( string $pluginType, string $pluginId, string $packageName, string $relativePackageUrl  )

Downloads a file from the repository.

If the file is a package, it will be put in the local cache and unpacked in the plugins/ directory. If it is a descriptor, it will be deserialized and returned to the calling function.

Parameters:
string   $pluginType: 
string   $pluginId: 
string   $packageName: 
string   $relativePackageUrl:  URL of the package to download relative to repository URL

API Tags:
Return:  GalleryStatus a status code array descriptor

Information Tags:
Todo:  Split this into two separate functions, one that downloads the file, the other that returns the descriptor. The function that downloads the file should take the descriptor so that it can verify that the file that got downloaded is the right length.

[ Top ]
downloadAndUnpackPackages  [line 953]

  array downloadAndUnpackPackages( array $filesToDownload, &$callback, string $source, array $callback  )

Retrieve all the specified files as one http request and separate into individual packages.

Parameters:
string   $source:  name of the repository to be accessed
array   $filesToDownload:  list of files to download
array   $callback:  progress notification callback
   &$callback: 

API Tags:
Return:  GalleryStatus a status code array string status messages indicating problems encounterd int count of packages installed


[ Top ]
downloadIndex  [line 905]

  void downloadIndex( )


API Tags:
See:  GalleryRepositoryIndex::update


[ Top ]
downloadPackagesForPlugin  [line 641]

  void downloadPackagesForPlugin( string $pluginType, string $pluginId, array $pluginDownloadData, &$callback, GalleryRepository $repository, array $callback  )

Download the specified packages.

Parameters:
GalleryRepository   $repository: 
string   $pluginType: 
string   $pluginId: 
array   $pluginDownloadData:  list of plugins to download
array   $callback:  information for progress bar updates
   &$callback: 


[ Top ]
getAllUpgradeablePackages  [line 440]

  array getAllUpgradeablePackages( )

Creates a list of all upgradeable packages.

It goes through all installed plugins and checks if an update is available to any of their packages and adds it to a list if it is.


API Tags:
Return:  GalleryStatus a status code array package list


[ Top ]
getDownloadFileList  [line 532]

  array getDownloadFileList( array $pluginData  )

Creates a list of URLs that

Parameters:
array   $pluginData:  array(pluginType => array(pluginId => array(packages)))

API Tags:
Return:  GalleryStatus a status code array list of packages with corresponding URLs


[ Top ]
getIndexMetaData  [line 919]

  void getIndexMetaData( )


API Tags:
See:  GalleryRepositoryIndex::getMetaData


[ Top ]
getLanguagePackageFiles  [line 940]

  void getLanguagePackageFiles( $locales  )

Parameters:
   $locales: 

API Tags:
See:  GalleryRepositoryIndex::getLanguagePackageFiles


[ Top ]
getPackageVersionAndBuild  [line 926]

  void getPackageVersionAndBuild( $pluginType, $pluginId, $packageName  )

Parameters:
   $pluginType: 
   $pluginId: 
   $packageName: 

API Tags:
See:  GalleryRepositoryIndex::getPackageVersionAndBuild


[ Top ]
getPluginName  [line 933]

  void getPluginName( $pluginType, $pluginId  )

Parameters:
   $pluginType: 
   $pluginId: 

API Tags:
See:  GalleryRepositoryIndex::getPluginName


[ Top ]
getPluginUpgradeInfo  [line 199]

  array getPluginUpgradeInfo( string $pluginType, string $pluginId, [bool $forBasePackageUpgrade = true]  )

Determines which packages of the specified plugin are newer in the repository.

Parameters:
string   $pluginType:  A plugin type (module|theme)
string   $pluginId:  A plugin id
bool   $forBasePackageUpgrade:  (optional) Include all packages that are upgradeable once the base package has been upgraded. Default true.

API Tags:
Return:  GalleryStatus a status code array package list


[ Top ]
getRepositoryPluginList  [line 312]

  array getRepositoryPluginList( string $pluginType, [boolean $showAllPlugins = false], [array $coreApis = null]  )

Returns a list of plugins of the specified type.

It can return a list of compatible plugins with specific core APIs. By default, compatibility is determined by comparing the repository plugin requirements with the currently installed APIs, but API versions can be specified, so it is possible to, for example, get a compatibility list based on future API versions.

Parameters:
string   $pluginType: 
boolean   $showAllPlugins:  show incompatible plugins
array   $coreApis:  core APIs to base compatibility check on 'core'/'module'/'theme' => array(versionMajor, versionMinor)

API Tags:
Return:  GalleryStatus a status code array plugin list


[ Top ]
init  [line 125]

  GalleryStatus init( $source  )

Initializes the repository index and utilities.

Parameters:
   $source: 

API Tags:
Return:  a status code


[ Top ]
isCoreUpgradeAvailable  [line 146]

  array isCoreUpgradeAvailable( )

Determines whether a core module upgrade is available.


API Tags:
Return:  GalleryStatus a status code boolean availability array repository core and plugin api versions


[ Top ]
localIndexExists  [line 898]

  void localIndexExists( )


API Tags:
See:  GalleryRepositoryIndex::existsInCache


[ Top ]
pluginExistsInIndex  [line 912]

  void pluginExistsInIndex( $pluginType, $pluginId  )

Parameters:
   $pluginType: 
   $pluginId: 

API Tags:
See:  GalleryRepositoryIndex::containsPlugin


[ Top ]
preVerifyPackage  [line 761]

  array preVerifyPackage( string $packageName, array $descriptor  )

Verify that a package will install cleanly by examining all of its paths and making sure that any file operations that we intend to make will be successful.

Parameters:
string   $packageName:  name of the package to check
array   $descriptor:  descriptor of the plugin the package belongs to

API Tags:
Return:  of files that can't be overwritten (empty array if everything is ok)


[ Top ]
removeObsoleteFiles  [line 1085]

  void removeObsoleteFiles( string $pluginType, string $pluginId  )

Remove obsolete files when a plugin is updated.

Parameters:
string   $pluginType:  A plugin type (module|theme)
string   $pluginId:  A plugin id

API Tags:
Access:  public


[ Top ]
scanPlugin  [line 785]

  GalleryStatus scanPlugin( mixed $pluginType, mixed $pluginId  )

Scan one plugin and update its entries in the GalleryPluginPackageMap.


API Tags:
Return:  a status code


[ Top ]
updatePackageMetaData  [line 487]

  void updatePackageMetaData( $pluginType, $pluginId, $packageName, $packageVersion, $packageBuild, $locked  )

Parameters:
   $pluginType: 
   $pluginId: 
   $packageName: 
   $packageVersion: 
   $packageBuild: 
   $locked: 

API Tags:
Deprecated:  Only called from this class so remove on next major api bump.
See:  GalleryRepositoryUtilities::updatePackageMetaData


[ Top ]
verifyPackageIntegrity  [line 773]

  GalleryStatus verifyPackageIntegrity( string $packageName, array $descriptor  )

Verifies the integrity of the specified packages' unpacked files.

Parameters:
string   $packageName:  name of the package to check
array   $descriptor:  descriptor of the plugin the package belongs to

API Tags:
Return:  a status code


[ Top ]
_preverifyAggregatePackages  [line 1036]

  array _preverifyAggregatePackages( array $packages, &$callback, array $callback  )

Preverify that we will have no trouble unpacking and writing the packages we downloaded

Parameters:
array   $packages:  packages returned from splitAggregatePackage
array   $callback:  progress notification callback
   &$callback: 

API Tags:
Return:  GalleryStatus a status code array string status messages indicating problems encounterd


[ Top ]

Documentation generated on Fri, 08 Oct 2010 05:03:24 -0700 by phpDocumentor 1.3.0RC6