Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
006e1162
Commit
006e1162
authored
4 years ago
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style: add missing DocBlocks
parent
57262809
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
334 additions
and
22 deletions
+334
-22
admin.php
qa-include/app/admin.php
+2
-2
qa-base.php
qa-include/qa-base.php
+6
-6
Container.php
qa-src/App/Container.php
+1
-0
DbConnection.php
qa-src/Database/DbConnection.php
+1
-0
DbQueryHelper.php
qa-src/Database/DbQueryHelper.php
+2
-1
Router.php
qa-src/Http/Router.php
+1
-5
AbstractFinalStep.php
qa-src/Recalc/AbstractFinalStep.php
+3
-0
AbstractStep.php
qa-src/Recalc/AbstractStep.php
+28
-4
BlobsMoveComplete.php
qa-src/Recalc/BlobsMoveComplete.php
+4
-0
BlobsToDB.php
qa-src/Recalc/BlobsToDB.php
+4
-0
BlobsToDBMove.php
qa-src/Recalc/BlobsToDBMove.php
+8
-0
BlobsToDisk.php
qa-src/Recalc/BlobsToDisk.php
+4
-0
BlobsToDiskMove.php
qa-src/Recalc/BlobsToDiskMove.php
+8
-0
CacheClear.php
qa-src/Recalc/CacheClear.php
+4
-0
CacheClearComplete.php
qa-src/Recalc/CacheClearComplete.php
+4
-0
CacheClearProcess.php
qa-src/Recalc/CacheClearProcess.php
+8
-0
CacheTrim.php
qa-src/Recalc/CacheTrim.php
+4
-0
DeleteHidden.php
qa-src/Recalc/DeleteHidden.php
+4
-0
DeleteHiddenAnswers.php
qa-src/Recalc/DeleteHiddenAnswers.php
+8
-0
DeleteHiddenComments.php
qa-src/Recalc/DeleteHiddenComments.php
+8
-0
DeleteHiddenComplete.php
qa-src/Recalc/DeleteHiddenComplete.php
+4
-0
DeleteHiddenQuestions.php
qa-src/Recalc/DeleteHiddenQuestions.php
+8
-0
RecalcCategories.php
qa-src/Recalc/RecalcCategories.php
+4
-0
RecalcCategoriesBackPaths.php
qa-src/Recalc/RecalcCategoriesBackPaths.php
+8
-0
RecalcCategoriesComplete.php
qa-src/Recalc/RecalcCategoriesComplete.php
+4
-0
RecalcCategoriesPostCount.php
qa-src/Recalc/RecalcCategoriesPostCount.php
+4
-0
RecalcCategoriesPostUpdate.php
qa-src/Recalc/RecalcCategoriesPostUpdate.php
+8
-0
RecalcCategoriesRecount.php
qa-src/Recalc/RecalcCategoriesRecount.php
+8
-0
RecalcMain.php
qa-src/Recalc/RecalcMain.php
+10
-1
RecalcPoints.php
qa-src/Recalc/RecalcPoints.php
+4
-0
RecalcPointsComplete.php
qa-src/Recalc/RecalcPointsComplete.php
+4
-0
RecalcPointsRecalc.php
qa-src/Recalc/RecalcPointsRecalc.php
+8
-0
RecalcPointsUserCount.php
qa-src/Recalc/RecalcPointsUserCount.php
+8
-0
RecountPosts.php
qa-src/Recalc/RecountPosts.php
+4
-0
RecountPostsACount.php
qa-src/Recalc/RecountPostsACount.php
+8
-0
RecountPostsComplete.php
qa-src/Recalc/RecountPostsComplete.php
+4
-0
RecountPostsPostCount.php
qa-src/Recalc/RecountPostsPostCount.php
+8
-0
RecountPostsVoteCount.php
qa-src/Recalc/RecountPostsVoteCount.php
+8
-0
RefillEvents.php
qa-src/Recalc/RefillEvents.php
+4
-0
RefillEventsComplete.php
qa-src/Recalc/RefillEventsComplete.php
+4
-0
RefillEventsQCount.php
qa-src/Recalc/RefillEventsQCount.php
+8
-0
RefillEventsRefill.php
qa-src/Recalc/RefillEventsRefill.php
+12
-0
ReindexContent.php
qa-src/Recalc/ReindexContent.php
+4
-0
ReindexContentPageReindex.php
qa-src/Recalc/ReindexContentPageReindex.php
+8
-0
ReindexContentPostCount.php
qa-src/Recalc/ReindexContentPostCount.php
+8
-0
ReindexContentPostReindex.php
qa-src/Recalc/ReindexContentPostReindex.php
+8
-0
ReindexPostsComplete.php
qa-src/Recalc/ReindexPostsComplete.php
+4
-0
ReindexPostsWordCount.php
qa-src/Recalc/ReindexPostsWordCount.php
+8
-0
State.php
qa-src/Recalc/State.php
+26
-3
ruleset-strict.xml
qa-tests/phpcs/ruleset-strict.xml
+12
-0
ruleset.xml
qa-tests/phpcs/ruleset.xml
+2
-0
No files found.
qa-include/app/admin.php
View file @
006e1162
...
@@ -57,8 +57,8 @@ function qa_admin_check_privileges(&$qa_content)
...
@@ -57,8 +57,8 @@ function qa_admin_check_privileges(&$qa_content)
/**
/**
*
Return a sorted array of available languages, [short code] => [long name]
*
Return a sorted array of available languages, [short code] => [long name]
*
@return array
*
@return array
*/
*/
function
qa_admin_language_options
()
function
qa_admin_language_options
()
{
{
...
...
This diff is collapsed.
Click to expand it.
qa-include/qa-base.php
View file @
006e1162
...
@@ -1289,12 +1289,12 @@ function qa_post_limit_exceeded()
...
@@ -1289,12 +1289,12 @@ function qa_post_limit_exceeded()
/**
/**
* Turns a numeric value and a unit (g/m/k) into bytes
* Turns a numeric value and a unit (g/m/k) into bytes
* @param string $unit One of 'g', 'm', 'k'. It is case insensitive
* @param string $unit One of 'g', 'm', 'k'. It is case insensitive
* @param int $value The value to turn into bytes
* @param int $value The value to turn into bytes
* @return int The amount of bytes the unit and the value represent. If the unit is not one of 'g', 'm' or 'k' then the
* @return int The amount of bytes the unit and the value represent. If the unit is not one of 'g', 'm' or 'k' then the
* original value is returned
* original value is returned
*/
*/
function
convert_to_bytes
(
$unit
,
$value
)
function
convert_to_bytes
(
$unit
,
$value
)
{
{
$value
=
(
int
)
$value
;
$value
=
(
int
)
$value
;
...
...
This diff is collapsed.
Click to expand it.
qa-src/App/Container.php
View file @
006e1162
...
@@ -37,6 +37,7 @@ class Container
...
@@ -37,6 +37,7 @@ class Container
/**
/**
* Return an object assigned to the given key. If the key is not found an exception is thrown.
* Return an object assigned to the given key. If the key is not found an exception is thrown.
* @throws FatalErrorException
* @param string $key The key to look for
* @param string $key The key to look for
* @return mixed
* @return mixed
*/
*/
...
...
This diff is collapsed.
Click to expand it.
qa-src/Database/DbConnection.php
View file @
006e1162
...
@@ -173,6 +173,7 @@ class DbConnection
...
@@ -173,6 +173,7 @@ class DbConnection
/**
/**
* Prepare and execute a SQL query, handling any failures. In debugging mode, track the queries and resources used.
* Prepare and execute a SQL query, handling any failures. In debugging mode, track the queries and resources used.
* @throws SelectSpecException
* @param string $query
* @param string $query
* @param array $params
* @param array $params
* @return DbResult
* @return DbResult
...
...
This diff is collapsed.
Click to expand it.
qa-src/Database/DbQueryHelper.php
View file @
006e1162
...
@@ -68,10 +68,10 @@ class DbQueryHelper
...
@@ -68,10 +68,10 @@ class DbQueryHelper
/**
/**
* Substitute single '?' in a SQL query with multiple '?' for array parameters, and flatten parameter list accordingly.
* Substitute single '?' in a SQL query with multiple '?' for array parameters, and flatten parameter list accordingly.
* @throws SelectSpecException
* @param string $query
* @param string $query
* @param array $params
* @param array $params
* @return array Query and flattened parameter list
* @return array Query and flattened parameter list
* @throws SelectSpecException
*/
*/
public
function
expandParameters
(
$query
,
array
$params
=
[])
public
function
expandParameters
(
$query
,
array
$params
=
[])
{
{
...
@@ -139,6 +139,7 @@ class DbQueryHelper
...
@@ -139,6 +139,7 @@ class DbQueryHelper
* INSERT INTO..VALUES query for inserting multiple rows.
* INSERT INTO..VALUES query for inserting multiple rows.
* If the first subparam is an array, the rest of the parameter groups should have the same
* If the first subparam is an array, the rest of the parameter groups should have the same
* amount of elements, i.e. the output should be '(?, ?), (?, ?)' rather than '(?), (?, ?)'.
* amount of elements, i.e. the output should be '(?, ?), (?, ?)' rather than '(?), (?, ?)'.
* @throws SelectSpecException
* @param array $subArray
* @param array $subArray
* @param string $outQuery
* @param string $outQuery
* @param array $outParams
* @param array $outParams
...
...
This diff is collapsed.
Click to expand it.
qa-src/Http/Router.php
View file @
006e1162
...
@@ -57,9 +57,8 @@ class Router
...
@@ -57,9 +57,8 @@ class Router
/**
/**
* Return the route definition that matches the given request. If none is found then null is
* Return the route definition that matches the given request. If none is found then null is
* returned.
* returned.
*
*
@throws MethodNotAllowedException
* @param string $request Request that will be looked for a match
* @param string $request Request that will be looked for a match
*
* @return Route|null
* @return Route|null
*/
*/
public
function
match
(
$request
)
public
function
match
(
$request
)
...
@@ -88,9 +87,7 @@ class Router
...
@@ -88,9 +87,7 @@ class Router
/**
/**
* Build the final regular expression to match the request. This method replaces all the
* Build the final regular expression to match the request. This method replaces all the
* parameters' placeholders with the given regular expression.
* parameters' placeholders with the given regular expression.
*
* @param string $routePath Route that might have placeholders
* @param string $routePath Route that might have placeholders
*
* @return string
* @return string
*/
*/
private
function
buildPathRegex
(
$routePath
)
private
function
buildPathRegex
(
$routePath
)
...
@@ -100,7 +97,6 @@ class Router
...
@@ -100,7 +97,6 @@ class Router
/**
/**
* Return the HTTP method of the current request.
* Return the HTTP method of the current request.
*
* @return string
* @return string
*/
*/
public
function
getHttpMethod
()
public
function
getHttpMethod
()
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/AbstractFinalStep.php
View file @
006e1162
...
@@ -25,10 +25,13 @@ abstract class AbstractFinalStep extends AbstractStep
...
@@ -25,10 +25,13 @@ abstract class AbstractFinalStep extends AbstractStep
protected
$isFinalStep
=
true
;
protected
$isFinalStep
=
true
;
/**
/**
* Should not be called.
* @throws Exception
* @throws Exception
* @return bool
*/
*/
public
function
doStep
()
public
function
doStep
()
{
{
throw
new
Exception
(
'Do not process the completion step.'
);
throw
new
Exception
(
'Do not process the completion step.'
);
return
false
;
}
}
}
}
This diff is collapsed.
Click to expand it.
qa-src/Recalc/AbstractStep.php
View file @
006e1162
...
@@ -20,9 +20,16 @@ namespace Q2A\Recalc;
...
@@ -20,9 +20,16 @@ namespace Q2A\Recalc;
abstract
class
AbstractStep
abstract
class
AbstractStep
{
{
/** @var string */
protected
$state
;
protected
$state
;
/** @var bool */
protected
$isFinalStep
=
false
;
protected
$isFinalStep
=
false
;
/**
* Initialize a step.
* @param State $state
*/
public
function
__construct
(
State
$state
)
public
function
__construct
(
State
$state
)
{
{
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
// for qa_format_number()
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
// for qa_format_number()
...
@@ -30,13 +37,25 @@ abstract class AbstractStep
...
@@ -30,13 +37,25 @@ abstract class AbstractStep
$this
->
state
=
$state
;
$this
->
state
=
$state
;
}
}
/**
* Execute the step.
* @return bool
*/
abstract
public
function
doStep
();
abstract
public
function
doStep
();
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
''
;
return
''
;
}
}
/**
* Whether to stop processing.
* @return bool
*/
public
function
isFinalStep
()
public
function
isFinalStep
()
{
{
return
$this
->
isFinalStep
;
return
$this
->
isFinalStep
;
...
@@ -45,12 +64,12 @@ abstract class AbstractStep
...
@@ -45,12 +64,12 @@ abstract class AbstractStep
/**
/**
* Return the translated language ID string replacing the progress and total in it.
* Return the translated language ID string replacing the progress and total in it.
*
*
* @param string $langId Language string ID that contains 2 placeholders (^1 and ^2)
* @param string $langId Language string ID that contains 2 placeholders (^1 and ^2)
.
* @param int $progress Amount of processed elements
* @param int $progress Amount of processed elements
.
* @param int $total Total amount of elements
* @param int $total Total amount of elements
.
*
*
* @return string Returns the language string ID with their placeholders replaced with
* @return string Returns the language string ID with their placeholders replaced with
* the formatted progress and total numbers
* the formatted progress and total numbers
.
*/
*/
protected
function
progressLang
(
$langId
,
$progress
,
$total
)
protected
function
progressLang
(
$langId
,
$progress
,
$total
)
{
{
...
@@ -60,6 +79,11 @@ abstract class AbstractStep
...
@@ -60,6 +79,11 @@ abstract class AbstractStep
));
));
}
}
/**
* Factory method to instantiate the State.
* @param State $state
* @return AbstractStep|null
*/
public
static
function
factory
(
State
$state
)
public
static
function
factory
(
State
$state
)
{
{
$class
=
$state
->
getOperationClass
();
$class
=
$state
->
getOperationClass
();
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/BlobsMoveComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
BlobsMoveComplete
extends
AbstractFinalStep
class
BlobsMoveComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/blobs_move_complete'
);
return
qa_lang
(
'admin/blobs_move_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/BlobsToDB.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
BlobsToDB
extends
AbstractStep
class
BlobsToDB
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'doblobstodb_move'
);
$this
->
state
->
transition
(
'doblobstodb_move'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/BlobsToDBMove.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
BlobsToDBMove
extends
AbstractStep
class
BlobsToDBMove
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$blob
=
qa_db_get_next_blob_on_disk
(
$this
->
state
->
next
);
$blob
=
qa_db_get_next_blob_on_disk
(
$this
->
state
->
next
);
...
@@ -40,6 +44,10 @@ class BlobsToDBMove extends AbstractStep
...
@@ -40,6 +44,10 @@ class BlobsToDBMove extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/blobs_move_moved'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/blobs_move_moved'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/BlobsToDisk.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
BlobsToDisk
extends
AbstractStep
class
BlobsToDisk
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'doblobstodisk_move'
);
$this
->
state
->
transition
(
'doblobstodisk_move'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/BlobsToDiskMove.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
BlobsToDiskMove
extends
AbstractStep
class
BlobsToDiskMove
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$blob
=
qa_db_get_next_blob_in_db
(
$this
->
state
->
next
);
$blob
=
qa_db_get_next_blob_in_db
(
$this
->
state
->
next
);
...
@@ -41,6 +45,10 @@ class BlobsToDiskMove extends AbstractStep
...
@@ -41,6 +45,10 @@ class BlobsToDiskMove extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/blobs_move_moved'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/blobs_move_moved'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/CacheClear.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
CacheClear
extends
AbstractStep
class
CacheClear
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'docacheclear_process'
);
$this
->
state
->
transition
(
'docacheclear_process'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/CacheClearComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
CacheClearComplete
extends
AbstractFinalStep
class
CacheClearComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/caching_delete_complete'
);
return
qa_lang
(
'admin/caching_delete_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/CacheClearProcess.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
CacheClearProcess
extends
AbstractStep
class
CacheClearProcess
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$cacheDriver
=
\Q2A\Storage\CacheFactory
::
getCacheDriver
();
$cacheDriver
=
\Q2A\Storage\CacheFactory
::
getCacheDriver
();
...
@@ -37,6 +41,10 @@ class CacheClearProcess extends AbstractStep
...
@@ -37,6 +41,10 @@ class CacheClearProcess extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/caching_delete_progress'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/caching_delete_progress'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/CacheTrim.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
CacheTrim
extends
AbstractStep
class
CacheTrim
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'docachetrim_process'
);
$this
->
state
->
transition
(
'docachetrim_process'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/DeleteHidden.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
DeleteHidden
extends
AbstractStep
class
DeleteHidden
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'dodeletehidden_comments'
);
$this
->
state
->
transition
(
'dodeletehidden_comments'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/DeleteHiddenAnswers.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
DeleteHiddenAnswers
extends
AbstractStep
class
DeleteHiddenAnswers
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$posts
=
qa_db_posts_get_for_deleting
(
'A'
,
$this
->
state
->
next
,
1
);
$posts
=
qa_db_posts_get_for_deleting
(
'A'
,
$this
->
state
->
next
,
1
);
...
@@ -39,6 +43,10 @@ class DeleteHiddenAnswers extends AbstractStep
...
@@ -39,6 +43,10 @@ class DeleteHiddenAnswers extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/hidden_answers_deleted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/hidden_answers_deleted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/DeleteHiddenComments.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
DeleteHiddenComments
extends
AbstractStep
class
DeleteHiddenComments
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$posts
=
qa_db_posts_get_for_deleting
(
'C'
,
$this
->
state
->
next
,
1
);
$posts
=
qa_db_posts_get_for_deleting
(
'C'
,
$this
->
state
->
next
,
1
);
...
@@ -39,6 +43,10 @@ class DeleteHiddenComments extends AbstractStep
...
@@ -39,6 +43,10 @@ class DeleteHiddenComments extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/hidden_comments_deleted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/hidden_comments_deleted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/DeleteHiddenComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
DeleteHiddenComplete
extends
AbstractFinalStep
class
DeleteHiddenComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/delete_hidden_complete'
);
return
qa_lang
(
'admin/delete_hidden_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/DeleteHiddenQuestions.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
DeleteHiddenQuestions
extends
AbstractStep
class
DeleteHiddenQuestions
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$posts
=
qa_db_posts_get_for_deleting
(
'Q'
,
$this
->
state
->
next
,
1
);
$posts
=
qa_db_posts_get_for_deleting
(
'Q'
,
$this
->
state
->
next
,
1
);
...
@@ -39,6 +43,10 @@ class DeleteHiddenQuestions extends AbstractStep
...
@@ -39,6 +43,10 @@ class DeleteHiddenQuestions extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/hidden_questions_deleted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/hidden_questions_deleted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcCategories.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcCategories
extends
AbstractStep
class
RecalcCategories
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'dorecalccategories_postcount'
);
$this
->
state
->
transition
(
'dorecalccategories_postcount'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcCategoriesBackPaths.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcCategoriesBackPaths
extends
AbstractStep
class
RecalcCategoriesBackPaths
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$categoryids
=
qa_db_categories_get_for_recalcs
(
$this
->
state
->
next
,
10
);
$categoryids
=
qa_db_categories_get_for_recalcs
(
$this
->
state
->
next
,
10
);
...
@@ -37,6 +41,10 @@ class RecalcCategoriesBackPaths extends AbstractStep
...
@@ -37,6 +41,10 @@ class RecalcCategoriesBackPaths extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/recalc_categories_backpaths'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/recalc_categories_backpaths'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcCategoriesComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcCategoriesComplete
extends
AbstractFinalStep
class
RecalcCategoriesComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recalc_categories_complete'
);
return
qa_lang
(
'admin/recalc_categories_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcCategoriesPostCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcCategoriesPostCount
extends
AbstractStep
class
RecalcCategoriesPostCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
qa_db_acount_update
();
qa_db_acount_update
();
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcCategoriesPostUpdate.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcCategoriesPostUpdate
extends
AbstractStep
class
RecalcCategoriesPostUpdate
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$postids
=
qa_db_posts_get_for_recategorizing
(
$this
->
state
->
next
,
100
);
$postids
=
qa_db_posts_get_for_recategorizing
(
$this
->
state
->
next
,
100
);
...
@@ -39,6 +43,10 @@ class RecalcCategoriesPostUpdate extends AbstractStep
...
@@ -39,6 +43,10 @@ class RecalcCategoriesPostUpdate extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/recalc_categories_updated'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/recalc_categories_updated'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcCategoriesRecount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcCategoriesRecount
extends
AbstractStep
class
RecalcCategoriesRecount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$categoryids
=
qa_db_categories_get_for_recalcs
(
$this
->
state
->
next
,
10
);
$categoryids
=
qa_db_categories_get_for_recalcs
(
$this
->
state
->
next
,
10
);
...
@@ -39,6 +43,10 @@ class RecalcCategoriesRecount extends AbstractStep
...
@@ -39,6 +43,10 @@ class RecalcCategoriesRecount extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/recalc_categories_recounting'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/recalc_categories_recounting'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcMain.php
View file @
006e1162
...
@@ -60,6 +60,7 @@ class RecalcMain
...
@@ -60,6 +60,7 @@ class RecalcMain
/**
/**
* Initialize the counts of resource usage.
* Initialize the counts of resource usage.
* @param string $state
*/
*/
public
function
__construct
(
$state
)
public
function
__construct
(
$state
)
{
{
...
@@ -76,11 +77,19 @@ class RecalcMain
...
@@ -76,11 +77,19 @@ class RecalcMain
$this
->
state
=
new
\Q2A\Recalc\State
(
$state
);
$this
->
state
=
new
\Q2A\Recalc\State
(
$state
);
}
}
/**
* Get the state.
* @return string
*/
public
function
getState
()
public
function
getState
()
{
{
return
$this
->
state
->
getState
();
return
$this
->
state
->
getState
();
}
}
/**
* Do the recalculation.
* @return bool
*/
public
function
performStep
()
public
function
performStep
()
{
{
$step
=
AbstractStep
::
factory
(
$this
->
state
);
$step
=
AbstractStep
::
factory
(
$this
->
state
);
...
@@ -99,7 +108,7 @@ class RecalcMain
...
@@ -99,7 +108,7 @@ class RecalcMain
}
}
/**
/**
* Return a string which gives a user-viewable version of $state
* Return a string which gives a user-viewable version of $state
.
* @return string
* @return string
*/
*/
public
function
getMessage
()
public
function
getMessage
()
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcPoints.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcPoints
extends
AbstractStep
class
RecalcPoints
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'dorecalcpoints_usercount'
);
$this
->
state
->
transition
(
'dorecalcpoints_usercount'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcPointsComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcPointsComplete
extends
AbstractFinalStep
class
RecalcPointsComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recalc_points_complete'
);
return
qa_lang
(
'admin/recalc_points_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcPointsRecalc.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcPointsRecalc
extends
AbstractStep
class
RecalcPointsRecalc
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$default_recalccount
=
10
;
$default_recalccount
=
10
;
...
@@ -46,6 +50,10 @@ class RecalcPointsRecalc extends AbstractStep
...
@@ -46,6 +50,10 @@ class RecalcPointsRecalc extends AbstractStep
}
}
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/recalc_points_recalced'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/recalc_points_recalced'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecalcPointsUserCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecalcPointsUserCount
extends
AbstractStep
class
RecalcPointsUserCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
qa_db_userpointscount_update
();
// for progress update - not necessarily accurate
qa_db_userpointscount_update
();
// for progress update - not necessarily accurate
...
@@ -28,6 +32,10 @@ class RecalcPointsUserCount extends AbstractStep
...
@@ -28,6 +32,10 @@ class RecalcPointsUserCount extends AbstractStep
return
false
;
return
false
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recalc_points_usercount'
);
return
qa_lang
(
'admin/recalc_points_usercount'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecountPosts.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecountPosts
extends
AbstractStep
class
RecountPosts
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'dorecountposts_postcount'
);
$this
->
state
->
transition
(
'dorecountposts_postcount'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecountPostsACount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecountPostsACount
extends
AbstractStep
class
RecountPostsACount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$postids
=
qa_db_posts_get_for_recounting
(
$this
->
state
->
next
,
1000
);
$postids
=
qa_db_posts_get_for_recounting
(
$this
->
state
->
next
,
1000
);
...
@@ -39,6 +43,10 @@ class RecountPostsACount extends AbstractStep
...
@@ -39,6 +43,10 @@ class RecountPostsACount extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/recount_posts_as_recounted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/recount_posts_as_recounted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecountPostsComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecountPostsComplete
extends
AbstractFinalStep
class
RecountPostsComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recount_posts_complete'
);
return
qa_lang
(
'admin/recount_posts_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecountPostsPostCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecountPostsPostCount
extends
AbstractStep
class
RecountPostsPostCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
qa_db_qcount_update
();
qa_db_qcount_update
();
...
@@ -32,6 +36,10 @@ class RecountPostsPostCount extends AbstractStep
...
@@ -32,6 +36,10 @@ class RecountPostsPostCount extends AbstractStep
return
false
;
return
false
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recalc_posts_count'
);
return
qa_lang
(
'admin/recalc_posts_count'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RecountPostsVoteCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RecountPostsVoteCount
extends
AbstractStep
class
RecountPostsVoteCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$postids
=
qa_db_posts_get_for_recounting
(
$this
->
state
->
next
,
1000
);
$postids
=
qa_db_posts_get_for_recounting
(
$this
->
state
->
next
,
1000
);
...
@@ -38,6 +42,10 @@ class RecountPostsVoteCount extends AbstractStep
...
@@ -38,6 +42,10 @@ class RecountPostsVoteCount extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/recount_posts_votes_recounted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/recount_posts_votes_recounted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RefillEvents.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RefillEvents
extends
AbstractStep
class
RefillEvents
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'dorefillevents_qcount'
);
$this
->
state
->
transition
(
'dorefillevents_qcount'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RefillEventsComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RefillEventsComplete
extends
AbstractFinalStep
class
RefillEventsComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/refill_events_complete'
);
return
qa_lang
(
'admin/refill_events_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RefillEventsQCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RefillEventsQCount
extends
AbstractStep
class
RefillEventsQCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
qa_db_qcount_update
();
qa_db_qcount_update
();
...
@@ -27,6 +31,10 @@ class RefillEventsQCount extends AbstractStep
...
@@ -27,6 +31,10 @@ class RefillEventsQCount extends AbstractStep
return
false
;
return
false
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recalc_posts_count'
);
return
qa_lang
(
'admin/recalc_posts_count'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/RefillEventsRefill.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
RefillEventsRefill
extends
AbstractStep
class
RefillEventsRefill
extends
AbstractStep
{
{
/**
* Include some extra files.
* @param State $state
*/
public
function
__construct
(
State
$state
)
public
function
__construct
(
State
$state
)
{
{
require_once
QA_INCLUDE_DIR
.
'app/events.php'
;
require_once
QA_INCLUDE_DIR
.
'app/events.php'
;
...
@@ -29,6 +33,10 @@ class RefillEventsRefill extends AbstractStep
...
@@ -29,6 +33,10 @@ class RefillEventsRefill extends AbstractStep
parent
::
__construct
(
$state
);
parent
::
__construct
(
$state
);
}
}
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$questionids
=
qa_db_qs_get_for_event_refilling
(
$this
->
state
->
next
,
1
);
$questionids
=
qa_db_qs_get_for_event_refilling
(
$this
->
state
->
next
,
1
);
...
@@ -124,6 +132,10 @@ class RefillEventsRefill extends AbstractStep
...
@@ -124,6 +132,10 @@ class RefillEventsRefill extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/refill_events_refilled'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/refill_events_refilled'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/ReindexContent.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
ReindexContent
extends
AbstractStep
class
ReindexContent
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$this
->
state
->
transition
(
'doreindexcontent_pagereindex'
);
$this
->
state
->
transition
(
'doreindexcontent_pagereindex'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/ReindexContentPageReindex.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
ReindexContentPageReindex
extends
AbstractStep
class
ReindexContentPageReindex
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$pages
=
qa_db_pages_get_for_reindexing
(
$this
->
state
->
next
,
10
);
$pages
=
qa_db_pages_get_for_reindexing
(
$this
->
state
->
next
,
10
);
...
@@ -56,6 +60,10 @@ class ReindexContentPageReindex extends AbstractStep
...
@@ -56,6 +60,10 @@ class ReindexContentPageReindex extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/reindex_pages_reindexed'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/reindex_pages_reindexed'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/ReindexContentPostCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
ReindexContentPostCount
extends
AbstractStep
class
ReindexContentPostCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
qa_db_qcount_update
();
qa_db_qcount_update
();
...
@@ -30,6 +34,10 @@ class ReindexContentPostCount extends AbstractStep
...
@@ -30,6 +34,10 @@ class ReindexContentPostCount extends AbstractStep
return
false
;
return
false
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/recalc_posts_count'
);
return
qa_lang
(
'admin/recalc_posts_count'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/ReindexContentPostReindex.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
ReindexContentPostReindex
extends
AbstractStep
class
ReindexContentPostReindex
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$posts
=
qa_db_posts_get_for_reindexing
(
$this
->
state
->
next
,
10
);
$posts
=
qa_db_posts_get_for_reindexing
(
$this
->
state
->
next
,
10
);
...
@@ -58,6 +62,10 @@ class ReindexContentPostReindex extends AbstractStep
...
@@ -58,6 +62,10 @@ class ReindexContentPostReindex extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/reindex_posts_reindexed'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/reindex_posts_reindexed'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/ReindexPostsComplete.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
ReindexPostsComplete
extends
AbstractFinalStep
class
ReindexPostsComplete
extends
AbstractFinalStep
{
{
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
qa_lang
(
'admin/reindex_posts_complete'
);
return
qa_lang
(
'admin/reindex_posts_complete'
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/ReindexPostsWordCount.php
View file @
006e1162
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
...
@@ -20,6 +20,10 @@ namespace Q2A\Recalc;
class
ReindexPostsWordCount
extends
AbstractStep
class
ReindexPostsWordCount
extends
AbstractStep
{
{
/**
* Perform the recalculation.
* @return bool
*/
public
function
doStep
()
public
function
doStep
()
{
{
$wordids
=
qa_db_words_prepare_for_recounting
(
$this
->
state
->
next
,
1000
);
$wordids
=
qa_db_words_prepare_for_recounting
(
$this
->
state
->
next
,
1000
);
...
@@ -39,6 +43,10 @@ class ReindexPostsWordCount extends AbstractStep
...
@@ -39,6 +43,10 @@ class ReindexPostsWordCount extends AbstractStep
return
true
;
return
true
;
}
}
/**
* Get the current progress.
* @return string
*/
public
function
getMessage
()
public
function
getMessage
()
{
{
return
$this
->
progressLang
(
'admin/reindex_posts_wordcounted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
return
$this
->
progressLang
(
'admin/reindex_posts_wordcounted'
,
$this
->
state
->
done
,
$this
->
state
->
length
);
...
...
This diff is collapsed.
Click to expand it.
qa-src/Recalc/State.php
View file @
006e1162
...
@@ -73,41 +73,64 @@ class State
...
@@ -73,41 +73,64 @@ class State
/**
/**
* Initialize the counts of resource usage.
* Initialize the counts of resource usage.
* @param string $state
*/
*/
public
function
__construct
(
$state
)
public
function
__construct
(
$state
)
{
{
$this
->
setState
(
$state
);
$this
->
setState
(
$state
);
}
}
/**
* Get the state.
* @return string
*/
public
function
getState
()
public
function
getState
()
{
{
return
$this
->
state
;
return
$this
->
state
;
}
}
/**
* Set the state.
* @param string $state
* @return void
*/
public
function
setState
(
$state
=
''
)
public
function
setState
(
$state
=
''
)
{
{
$this
->
state
=
$state
;
$this
->
state
=
$state
;
list
(
$this
->
operation
,
$this
->
length
,
$this
->
next
,
$this
->
done
)
=
explode
(
"
\t
"
,
$state
.
"
\t\t\t\t
"
);
list
(
$this
->
operation
,
$this
->
length
,
$this
->
next
,
$this
->
done
)
=
explode
(
"
\t
"
,
$state
.
"
\t\t\t\t
"
);
}
}
/**
* Update the state.
* @return void
*/
public
function
updateState
()
public
function
updateState
()
{
{
$this
->
state
=
$this
->
operation
.
"
\t
"
.
$this
->
length
.
"
\t
"
.
$this
->
next
.
"
\t
"
.
$this
->
done
;
$this
->
state
=
$this
->
operation
.
"
\t
"
.
$this
->
length
.
"
\t
"
.
$this
->
next
.
"
\t
"
.
$this
->
done
;
}
}
/**
* Get the class that will handle this operation.
* @return string|null
*/
public
function
getOperationClass
()
public
function
getOperationClass
()
{
{
return
isset
(
$this
->
classes
[
$this
->
operation
])
?
$this
->
classes
[
$this
->
operation
]
:
null
;
return
isset
(
$this
->
classes
[
$this
->
operation
])
?
$this
->
classes
[
$this
->
operation
]
:
null
;
}
}
/**
* Whether all steps are completed.
* @return bool
*/
public
function
allDone
()
public
function
allDone
()
{
{
return
$this
->
done
>=
$this
->
length
;
return
$this
->
done
>=
$this
->
length
;
}
}
/**
/**
* Change the $state to represent the beginning of a new $operation
* Change the $state to represent the beginning of a new $operation.
* @param $newOperation
* @param string $newOperation
* @return void
*/
*/
public
function
transition
(
$newOperation
)
public
function
transition
(
$newOperation
)
{
{
...
@@ -120,7 +143,7 @@ class State
...
@@ -120,7 +143,7 @@ class State
}
}
/**
/**
* Return how many steps there will be in recalculation
$operation
* Return how many steps there will be in recalculation
operation.
* @return int
* @return int
*/
*/
private
function
stageLength
()
private
function
stageLength
()
...
...
This diff is collapsed.
Click to expand it.
qa-tests/phpcs/ruleset-strict.xml
View file @
006e1162
...
@@ -30,4 +30,16 @@
...
@@ -30,4 +30,16 @@
</properties>
</properties>
</rule>
</rule>
<!-- Not part of normal usage, but kept for testing (default severity = 5) -->
<rule
ref=
"Squiz.Commenting.FunctionComment"
>
<severity>
0
</severity>
<exclude
name=
"Squiz.Commenting.FunctionComment.EmptyThrows"
/>
<exclude
name=
"Squiz.Commenting.FunctionComment.IncorrectParamVarName"
/>
<exclude
name=
"Squiz.Commenting.FunctionComment.InvalidReturn"
/>
<exclude
name=
"Squiz.Commenting.FunctionComment.MissingParamComment"
/>
<exclude
name=
"Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"
/>
<exclude
name=
"Squiz.Commenting.FunctionComment.SpacingAfterParamName"
/>
<exclude
name=
"Squiz.Commenting.FunctionComment.SpacingAfterParamType"
/>
</rule>
</ruleset>
</ruleset>
This diff is collapsed.
Click to expand it.
qa-tests/phpcs/ruleset.xml
View file @
006e1162
...
@@ -43,4 +43,6 @@
...
@@ -43,4 +43,6 @@
</properties>
</properties>
</rule>
</rule>
<rule
ref=
"Squiz.Commenting.DocCommentAlignment"
></rule>
</ruleset>
</ruleset>
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment