Commit 41bdb31b by pupi1985

PHPDoc update in db/blobs, db/hotness, db/limits and db/points

parent d64f2ad4
...@@ -27,13 +27,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -27,13 +27,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/** /**
* Create a new blob in the database with $content and $format, other fields as provided * Create a new blob in the database with $content and $format, other fields as provided
* @param $content * @param string $content
* @param $format * @param string $format
* @param $sourcefilename * @param string|null $sourcefilename
* @param $userid * @param mixed|null $userid
* @param $cookieid * @param string|null $cookieid
* @param $ip * @param string|null $ip
* @return mixed|null|string * @return mixed|string|null
*/ */
function qa_db_blob_create($content, $format, $sourcefilename = null, $userid = null, $cookieid = null, $ip = null) function qa_db_blob_create($content, $format, $sourcefilename = null, $userid = null, $cookieid = null, $ip = null)
{ {
...@@ -59,8 +59,8 @@ function qa_db_blob_create($content, $format, $sourcefilename = null, $userid = ...@@ -59,8 +59,8 @@ function qa_db_blob_create($content, $format, $sourcefilename = null, $userid =
/** /**
* Get the information about blob $blobid from the database * Get the information about blob $blobid from the database
* @param $blobid * @param string $blobid
* @return array|mixed|null * @return array|null
*/ */
function qa_db_blob_read($blobid) function qa_db_blob_read($blobid)
{ {
...@@ -75,8 +75,8 @@ function qa_db_blob_read($blobid) ...@@ -75,8 +75,8 @@ function qa_db_blob_read($blobid)
/** /**
* Change the content of blob $blobid in the database to $content (can also be null) * Change the content of blob $blobid in the database to $content (can also be null)
* @param $blobid * @param string $blobid
* @param $content * @param string $content
*/ */
function qa_db_blob_set_content($blobid, $content) function qa_db_blob_set_content($blobid, $content)
{ {
...@@ -89,7 +89,7 @@ function qa_db_blob_set_content($blobid, $content) ...@@ -89,7 +89,7 @@ function qa_db_blob_set_content($blobid, $content)
/** /**
* Delete blob $blobid in the database * Delete blob $blobid in the database
* @param $blobid * @param string $blobid
* @return mixed * @return mixed
*/ */
function qa_db_blob_delete($blobid) function qa_db_blob_delete($blobid)
...@@ -105,8 +105,8 @@ function qa_db_blob_delete($blobid) ...@@ -105,8 +105,8 @@ function qa_db_blob_delete($blobid)
/** /**
* Check if blob $blobid exists in the database * Check if blob $blobid exists in the database
* @param $blobid * @param string $blobid
* @return bool|mixed * @return bool
*/ */
function qa_db_blob_exists($blobid) function qa_db_blob_exists($blobid)
{ {
......
...@@ -46,9 +46,9 @@ function qa_db_increment_views($postid) ...@@ -46,9 +46,9 @@ function qa_db_increment_views($postid)
* *
* @param int $firstpostid First post to recalculate (or only post if $lastpostid is null). * @param int $firstpostid First post to recalculate (or only post if $lastpostid is null).
* @param int $lastpostid Last post in the range to recalculate. * @param int $lastpostid Last post in the range to recalculate.
* @param bool $viewincrement Deprecated - view counter is now incremented separately. Previously, would increment the post's * @param bool $viewincrement Deprecated - view counter is now incremented separately. Previously, would increment the
* views and include that in the hotness calculation. * post's views and include that in the hotness calculation.
* @return void * @return mixed
*/ */
function qa_db_hotness_update($firstpostid, $lastpostid = null, $viewincrement = false) function qa_db_hotness_update($firstpostid, $lastpostid = null, $viewincrement = false)
{ {
......
...@@ -28,9 +28,9 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -28,9 +28,9 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/** /**
* Get rate limit information for $action from the database for user $userid and/or IP address $ip, if they're set. * Get rate limit information for $action from the database for user $userid and/or IP address $ip, if they're set.
* Return as an array with the limit type in the key, and a labelled array of the period and count. * Return as an array with the limit type in the key, and a labelled array of the period and count.
* @param $userid * @param mixed $userid
* @param $ip * @param string|null $ip
* @param $action * @param string $action
* @return array * @return array
*/ */
function qa_db_limits_get($userid, $ip, $action) function qa_db_limits_get($userid, $ip, $action)
...@@ -50,7 +50,7 @@ function qa_db_limits_get($userid, $ip, $action) ...@@ -50,7 +50,7 @@ function qa_db_limits_get($userid, $ip, $action)
$arguments[] = $action; $arguments[] = $action;
} }
if (count($selects)) { if (!empty($selects)) {
$query = qa_db_apply_sub(implode(' UNION ALL ', $selects), $arguments); $query = qa_db_apply_sub(implode(' UNION ALL ', $selects), $arguments);
return qa_db_read_all_assoc(qa_db_query_raw($query), 'limitkey'); return qa_db_read_all_assoc(qa_db_query_raw($query), 'limitkey');
...@@ -61,10 +61,10 @@ function qa_db_limits_get($userid, $ip, $action) ...@@ -61,10 +61,10 @@ function qa_db_limits_get($userid, $ip, $action)
/** /**
* Increment the database rate limit count for user $userid and $action by $count within $period * Increment the database rate limit count for user $userid and $action by $count within $period
* @param $userid * @param mixed $userid
* @param $action * @param string $action
* @param $period * @param int $period
* @param $count * @param int $count
*/ */
function qa_db_limits_user_add($userid, $action, $period, $count) function qa_db_limits_user_add($userid, $action, $period, $count)
{ {
...@@ -78,10 +78,10 @@ function qa_db_limits_user_add($userid, $action, $period, $count) ...@@ -78,10 +78,10 @@ function qa_db_limits_user_add($userid, $action, $period, $count)
/** /**
* Increment the database rate limit count for IP address $ip and $action by $count within $period * Increment the database rate limit count for IP address $ip and $action by $count within $period
* @param $ip * @param string $ip
* @param $action * @param string $action
* @param $period * @param int $period
* @param $count * @param int $count
*/ */
function qa_db_limits_ip_add($ip, $action, $period, $count) function qa_db_limits_ip_add($ip, $action, $period, $count)
{ {
......
...@@ -27,6 +27,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -27,6 +27,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/** /**
* Returns an array of option names required to perform calculations in userpoints table * Returns an array of option names required to perform calculations in userpoints table
* @return mixed
*/ */
function qa_db_points_option_names() function qa_db_points_option_names()
{ {
...@@ -49,6 +50,7 @@ function qa_db_points_option_names() ...@@ -49,6 +50,7 @@ function qa_db_points_option_names()
* The element 'formula' contains the SQL fragment that calculates the columns value for one or more users, * The element 'formula' contains the SQL fragment that calculates the columns value for one or more users,
* where the ~ symbol within the fragment is substituted for a constraint on which users we are interested in. * where the ~ symbol within the fragment is substituted for a constraint on which users we are interested in.
* The element 'multiple' specifies what to multiply each column by to create the final sum in the points column. * The element 'multiple' specifies what to multiply each column by to create the final sum in the points column.
* @return mixed
*/ */
function qa_db_points_calculations() function qa_db_points_calculations()
{ {
...@@ -156,10 +158,10 @@ function qa_db_points_calculations() ...@@ -156,10 +158,10 @@ function qa_db_points_calculations()
/** /**
* Update the userpoints table in the database for $userid and $columns, plus the summary points column. * Update the userpoints table in the database for $userid and $columns, plus the summary points column.
* Set $columns to true for all, empty for none, an array for several, or a single value for one. * Set $columns to true for all, false for none, an array for several, or a single value for one.
* This dynamically builds some fairly crazy looking SQL, but it works, and saves repeat calculations. * This dynamically builds some fairly crazy looking SQL, but it works, and saves repeat calculations.
* @param $userid * @param mixed $userid
* @param $columns * @param bool|string|array $columns
* @return mixed * @return mixed
*/ */
function qa_db_points_update_ifuser($userid, $columns) function qa_db_points_update_ifuser($userid, $columns)
...@@ -217,8 +219,8 @@ function qa_db_points_update_ifuser($userid, $columns) ...@@ -217,8 +219,8 @@ function qa_db_points_update_ifuser($userid, $columns)
/** /**
* Set the number of explicit bonus points for $userid to $bonus * Set the number of explicit bonus points for $userid to $bonus
* @param $userid * @param mixed $userid
* @param $bonus * @param int $bonus
*/ */
function qa_db_points_set_bonus($userid, $bonus) function qa_db_points_set_bonus($userid, $bonus)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment