apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: PEAR_Frontend_Gtk2_Packages

Source Location: /PEAR_Frontend_Gtk2-1.1.0/PEAR/Frontend/Gtk2/Packages.php

Class Overview


This class deals with packages: local package loading, remote package loading and so.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 14]
This class deals with packages: local package loading, remote package loading and so.

The callback is called after everything has been finished with parameters (true, true) to signal that it's done.



[ Top ]


Class Variables

$arCategories =  null

[line 32]

Array of channel => category strings
  • Access: protected

Type:   array


[ Top ]

$arPackages =  null

[line 26]

Array of channel => package arrays
  • Access: protected

Type:   array


[ Top ]

$EXCEPTION_NO_REST =  451

[line 34]

  • Access: public

Type:   mixed


[ Top ]

$strActiveChannel =  null

[line 20]

The currently active channel name
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 38]

PEAR_Frontend_Gtk2_Packages __construct( [ $strActiveChannel = null])

  • Access: public

Parameters:

   $strActiveChannel   — 

[ Top ]

getActiveChannel   [line 52]

void getActiveChannel( )

  • Access: public

[ Top ]

getAllPackages   [line 99]

array getAllPackages( string $strChannel, [callback $callback = null], [boolean $bWorkOffline = false])

Gets an array of packages for the active channel (local and remote packages)
  • Return: Array of Packages
  • Access: public

Parameters:

string   $strChannel   —  Channel to get packages for
callback   $callback   —  The callback to call for each single remote package
boolean   $bWorkOffline   —  If the users wants to work offline

[ Top ]

getCategories   [line 411]

array getCategories( [callback $callback = null], [boolean $bWorkOffline = false])

Creates an array of categories (strings) of the current channel server
  • Return: Array of category strings
  • Access: public

Parameters:

callback   $callback   —  The callback to call when package information is loaded
boolean   $bWorkOffline   —  If the user wants to work offline (don't try to connect to the internet)

[ Top ]

getInfoUrl   [line 385]

void getInfoUrl( $strBaseUrl, $strPackageName)

Path to info.xml for the specific package
  • Access: public

Parameters:

   $strBaseUrl   — 
   $strPackageName   — 

[ Top ]

getLatestVersionUrl   [line 395]

void getLatestVersionUrl( $strBaseUrl, $strPackageName)

Path to latest.txt for the specific package
  • Access: public

Parameters:

   $strBaseUrl   — 
   $strPackageName   — 

[ Top ]

getLocalPackages   [line 121]

array getLocalPackages( string $strChannel, [array $arLocalPackages = array()])

Loads the locally installed packages of the given channel
  • Return: Array of locally installed packages
  • Access: public

Parameters:

string   $strChannel   —  The channel name
array   $arLocalPackages   —  Array with already existing local packages. If set, package info will be incorporated.

[ Top ]

getPackages   [line 69]

array getPackages( [string $strCategory = null], [callback $callback = null], [booleab $bWorkOffline = false])

Returns a list with all packages, or all packages in the given category.

Package list is cached, so that it's faster after the first call.

  • Return: Array of PEAR_Frontend_Gtk2_Package's
  • Access: public

Parameters:

string   $strCategory   —  If given, the list is filtered by category name
callback   $callback   —  The function to call before a package information is downloaded
booleab   $bWorkOffline   —  If the user wants to work offline (don't connect to the internet)

[ Top ]

getRemotePackages   [line 175]

array getRemotePackages( string $strChannel, [boolean $bLoadPackageData = true], [callback $callback = null], [array $arExistingPackages = array()], [boolean $bWorkOffline = false])

Loads the remotely available packages for the given channel
  • Return: Array of remotely available packages (PEAR_Frontend_Gtk2_Package)
  • Throws: Exception If the channel has no REST support or if the connection failed
  • Access: public

Parameters:

string   $strChannel   —  The channel name
boolean   $bLoadPackageData   —  If all the package data shall be loaded, not only the names
callback   $callback   —  The callback to call after a package info has been loaded
array   $arExistingPackages   —  Array with local packages already loaded
boolean   $bWorkOffline   —  If we should use the local cache if possible

[ Top ]

listPackages   [line 232]

mixed listPackages( string $strChannel, [boolean $bWorkOffline = false])

Copy of the PEAR_REST#listPackages function with the change that this one is able to get the list from the local cache.
  • Return: PEAR_Error or array (package list)
  • Access: public

Parameters:

string   $strChannel   —  The channel which packages shall be listed
boolean   $bWorkOffline   —  If false, the local cache is used - if true, the online list is loaded

[ Top ]

loadRemotePackageData   [line 286]

array loadRemotePackageData( array $arRemotePackages, string $strChannel, [callback $callback = null], [boolean $bWorkOffline = false], [boolean $bUseCache = true])

Loads all available information for the given packages
  • Return: Array of packages (locally installed and remotely available) (PEAR_Frontend_Gtk2_Package)
  • Access: public

Parameters:

array   $arRemotePackages   —  Array with PEAR_Frontend_Gtk2_Package-s
string   $strChannel   —  The channel name to retrieve packages from
callback   $callback   —  The callback to call after a package info has been loaded
boolean   $bWorkOffline   —  If the local cache *only* shall be used, or (if no local cache is there) an connection to the internet server shall be made
boolean   $bUseCache   —  If the cache shall be used. If not, the only chance to get package data is reading them from the online server (if $bWorkOffline is false)

[ Top ]

packagesLoaded   [line 437]

boolean packagesLoaded( [string $strChannel = null])

Checks if the packages for the given channel have already been loaded
  • Return: true if the packages already have been loaded, false if not
  • Access: public

Parameters:

string   $strChannel   —  The channel to check (active channel if null)

[ Top ]

refreshLocalPackages   [line 454]

array refreshLocalPackages( [string $strChannel = null])

Refreshs the package list of the given channel by re-reading the local package info
  • Return: Package list for the given channel
  • Access: public

Parameters:

string   $strChannel   —  The channel to update. If NULL, the active one is used

[ Top ]

refreshRemotePackages   [line 476]

array refreshRemotePackages( [string $strChannel = null], [ $callback = null])

Refreshs the package list of the given channel by re-reading the remote package information.
  • Return: Package list for the given channel
  • Access: public

Parameters:

string   $strChannel   —  The channel to update. If NULL, the active one is used
   $callback   — 

[ Top ]

retrieveCacheFirst   [line 364]

void retrieveCacheFirst( string $url, PEAR_Config $config, PEAR_REST $rest, [boolean $bWorkOffline = false], [boolean $bUseCache = true])

Copy of the PEAR_REST#retrieveCacheFirst() function with the addition that one can specify if the cache only shall be loaded, or if the cache is not available, an connection shall be made.

If the user works offline, and no cache is there, NULL is returned.

  • Access: public

Parameters:

string   $url   —  The URL to get the data from
PEAR_Config   $config   —  The PEAR configuration
PEAR_REST   $rest   —  The REST object which can be used to retrieve the data
boolean   $bWorkOffline   —  If the local cache *only* shall be used, or (if no local cache is there) an connection to the internet server shall be made
boolean   $bUseCache   —  If the cache shall be used. If not, the only chance to get package data is reading them from the online server (if $bWorkOffline is false)

[ Top ]

setActiveChannel   [line 45]

void setActiveChannel( $strActiveChannel)

  • Access: public

Parameters:

   $strActiveChannel   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:46:48 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.