Skip to content

Commit

Permalink
feature 2999; docblocks for history, install and metadata
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@26946 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Jan 24, 2014
1 parent 01324a5 commit 1f448f9
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 15 deletions.
20 changes: 20 additions & 0 deletions admin/include/functions_history.inc.php
Expand Up @@ -21,8 +21,17 @@
// | USA. |
// +-----------------------------------------------------------------------+

/**
* @package functions\admin\history
*/


include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');

/**
* Init tabsheet for history pages
* @ignore
*/
function history_tabsheet()
{
global $page, $link_start;
Expand All @@ -34,11 +43,22 @@ function history_tabsheet()
$tabsheet->assign();
}

/**
* Callback used to sort history entries
*/
function history_compare($a, $b)
{
return strcmp($a['date'].$a['time'], $b['date'].$b['time']);
}

/**
* Perform history search.
*
* @param array $data - used in trigger_change
* @param array $search
* @param string[] $types
* @param array
*/
function get_history($data, $search, $types)
{
if (isset($search['fields']['filename']))
Expand Down
24 changes: 16 additions & 8 deletions admin/include/functions_install.inc.php
Expand Up @@ -22,16 +22,19 @@
// +-----------------------------------------------------------------------+

/**
* loads an sql file and executes all queries
*
* @package functions\admin\install
*/


/**
* Loads a SQL file and executes all queries.
* Before executing a query, $replaced is... replaced by $replacing. This is
* useful when the SQL file contains generic words. Drop table queries are
* not executed.
*
* @param string filepath
* @param string replaced
* @param string replacing
* @return void
* @param string $filepath
* @param string $replaced
* @param string $replacing
*/
function execute_sqlfile($filepath, $replaced, $replacing, $dblayer)
{
Expand Down Expand Up @@ -70,8 +73,6 @@ function execute_sqlfile($filepath, $replaced, $replacing, $dblayer)

/**
* Automatically activate all core themes in the "themes" directory.
*
* @return void
*/
function activate_core_themes()
{
Expand All @@ -86,6 +87,12 @@ function activate_core_themes()
}
}

/**
* Connect to database during installation. Uses $_POST.
*
* @param array &$infos - populated with infos
* @param array &$errors - populated with errors
*/
function install_db_connect(&$infos, &$errors)
{
try
Expand All @@ -99,4 +106,5 @@ function install_db_connect(&$infos, &$errors)
$errors[] = l10n($e->getMessage());
}
}

?>
48 changes: 41 additions & 7 deletions admin/include/functions_metadata.php
Expand Up @@ -21,9 +21,21 @@
// | USA. |
// +-----------------------------------------------------------------------+

/**
* @package functions\admin\metadata
*/


include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');


/**
* Returns IPTC metadata to sync from a file, depending on IPTC mapping.
* @toto : clean code (factorize foreach)
*
* @param string $file
* @return array
*/
function get_sync_iptc_data($file)
{
global $conf;
Expand Down Expand Up @@ -80,6 +92,12 @@ function get_sync_iptc_data($file)
return $iptc;
}

/**
* Returns EXIF metadata to sync from a file, depending on EXIF mapping.
*
* @param string $file
* @return array
*/
function get_sync_exif_data($file)
{
global $conf;
Expand Down Expand Up @@ -110,7 +128,11 @@ function get_sync_exif_data($file)
return $exif;
}


/**
* Get all potential file metadata fields, including IPTC and EXIF.
*
* @return string[]
*/
function get_sync_metadata_attributes()
{
global $conf;
Expand Down Expand Up @@ -139,6 +161,12 @@ function get_sync_metadata_attributes()
return array_unique($update_fields);
}

/**
* Get all metadata of a file.
*
* @param array $infos - (path[, representative_ext])
* @return array - includes data provided in $infos
*/
function get_sync_metadata($infos)
{
global $conf;
Expand Down Expand Up @@ -178,7 +206,12 @@ function get_sync_metadata($infos)
return $infos;
}


/**
* Sync all metadata of a list of images.
* Metadata are fetched from original files and saved in database.
*
* @param int[] $ids
*/
function sync_metadata($ids)
{
global $conf;
Expand Down Expand Up @@ -255,13 +288,13 @@ function sync_metadata($ids)
}

/**
* returns an array associating element id (images.id) with its complete
* Returns an array associating element id (images.id) with its complete
* path in the filesystem
*
* @param int id_uppercat
* @param int site_id
* @param boolean recursive ?
* @param boolean only newly added files ?
* @param int $category_id
* @param int $site_id
* @param boolean $recursive
* @param boolean $only_new
* @return array
*/
function get_filelist($category_id = '', $site_id=1, $recursive = false,
Expand Down Expand Up @@ -317,4 +350,5 @@ function get_filelist($category_id = '', $site_id=1, $recursive = false,
;';
return hash_from_query($query, 'id');
}

?>

0 comments on commit 1f448f9

Please sign in to comment.