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
4234de91
Commit
4234de91
authored
Jan 15, 2019
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (strict): control braces
parent
7c6b6de0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
18 deletions
+25
-18
UserPosts.php
qa-src/Controllers/User/UserPosts.php
+11
-7
UserProfile.php
qa-src/Controllers/User/UserProfile.php
+0
-0
DbConnection.php
qa-src/Database/DbConnection.php
+13
-7
CacheFactory.php
qa-src/Storage/CacheFactory.php
+1
-2
ruleset-strict.xml
qa-tests/phpcs/ruleset-strict.xml
+0
-2
No files found.
qa-src/Controllers/User/UserPosts.php
View file @
4234de91
...
...
@@ -70,10 +70,11 @@ class UserPosts extends \Q2A\Controllers\BaseController
$qa_content
=
qa_content_prepare
(
true
);
if
(
count
(
$questions
))
if
(
count
(
$questions
))
{
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/recent_activity_by_x'
,
$this
->
userhtml
);
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_posts_by_x'
,
$this
->
userhtml
);
}
// Recent activity by this user
...
...
@@ -154,10 +155,11 @@ class UserPosts extends \Q2A\Controllers\BaseController
$qa_content
=
qa_content_prepare
(
true
);
if
(
count
(
$questions
))
if
(
count
(
$questions
))
{
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/questions_by_x'
,
$this
->
userhtml
);
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_questions_by_x'
,
$this
->
userhtml
);
}
// Recent questions by this user
...
...
@@ -240,10 +242,11 @@ class UserPosts extends \Q2A\Controllers\BaseController
$qa_content
=
qa_content_prepare
(
true
);
if
(
count
(
$questions
))
if
(
count
(
$questions
))
{
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/answers_by_x'
,
$this
->
userhtml
);
else
}
else
{
$qa_content
[
'title'
]
=
qa_lang_html_sub
(
'profile/no_answers_by_x'
,
$this
->
userhtml
);
}
// Recent questions by this user
...
...
@@ -299,7 +302,8 @@ class UserPosts extends \Q2A\Controllers\BaseController
$usershtml
=
qa_get_users_html
(
array
(
$this
->
userid
),
false
,
qa_path_to_root
(),
true
);
$this
->
userhtml
=
@
$usershtml
[
$this
->
userid
];
}
else
}
else
{
$this
->
userhtml
=
qa_html
(
$handle
);
}
}
}
qa-src/Controllers/User/UserProfile.php
View file @
4234de91
This diff is collapsed.
Click to expand it.
qa-src/Database/DbConnection.php
View file @
4234de91
...
...
@@ -266,8 +266,9 @@ class DbConnection
if
(
$cacheDriver
->
isEnabled
())
{
$queryData
=
$cacheDriver
->
get
(
$cacheKey
);
if
(
$queryData
!==
null
)
if
(
$queryData
!==
null
)
{
return
$queryData
;
}
}
}
...
...
@@ -311,8 +312,9 @@ class DbConnection
if
(
!
QA_OPTIMIZE_DISTANT_DB
||
count
(
$selectspecs
)
<=
1
)
{
$outresults
=
array
();
foreach
(
$selectspecs
as
$selectkey
=>
$selectspec
)
foreach
(
$selectspecs
as
$selectkey
=>
$selectspec
)
{
$outresults
[
$selectkey
]
=
$this
->
singleSelect
(
$selectspec
);
}
return
$outresults
;
}
...
...
@@ -390,21 +392,24 @@ class DbConnection
$rawresults
=
$stmt
->
fetchAllAssoc
();
$outresults
=
array
();
foreach
(
$selectspecs
as
$selectkey
=>
$selectspec
)
foreach
(
$selectspecs
as
$selectkey
=>
$selectspec
)
{
$outresults
[
$selectkey
]
=
array
();
}
foreach
(
$rawresults
as
$rawresult
)
{
$selectkey
=
$rawresult
[
'selectkey'
];
$selectspec
=
$selectspecs
[
$selectkey
];
$keepresult
=
array
();
foreach
(
$selectspec
[
'outcolumns'
]
as
$columnas
=>
$columnfrom
)
foreach
(
$selectspec
[
'outcolumns'
]
as
$columnas
=>
$columnfrom
)
{
$keepresult
[
$columnas
]
=
$rawresult
[
$columnas
];
}
if
(
isset
(
$selectspec
[
'arraykey'
]))
if
(
isset
(
$selectspec
[
'arraykey'
]))
{
$outresults
[
$selectkey
][
$keepresult
[
$selectspec
[
'arraykey'
]]]
=
$keepresult
;
else
}
else
{
$outresults
[
$selectkey
][]
=
$keepresult
;
}
}
// Post-processing to apply various stuff include sorting request, since we can't rely on ORDER BY due to UNION
...
...
@@ -442,8 +447,9 @@ class DbConnection
qa_sort_by
(
$outresult
,
$selectspec
[
'sortdesc'
],
$selectspec
[
'sortdesc_2'
]);
}
else
{
$index
=
count
(
$outresult
);
foreach
(
$outresult
as
$key
=>
$value
)
foreach
(
$outresult
as
$key
=>
$value
)
{
$outresult
[
$key
][
'_order_'
]
=
$index
--
;
}
qa_sort_by
(
$outresult
,
$selectspec
[
'sortdesc'
],
'_order_'
);
}
...
...
qa-src/Storage/CacheFactory.php
View file @
4234de91
...
...
@@ -40,8 +40,7 @@ class CacheFactory
$driver
=
qa_opt
(
'caching_driver'
);
switch
(
$driver
)
{
switch
(
$driver
)
{
case
'memcached'
:
self
::
$cacheDriver
=
new
MemcachedDriver
(
$config
);
break
;
...
...
qa-tests/phpcs/ruleset-strict.xml
View file @
4234de91
...
...
@@ -13,8 +13,6 @@
<rule
ref=
"PSR2"
>
<exclude
name=
"Generic.WhiteSpace.DisallowTabIndent"
/>
<exclude
name=
"Generic.Files.LineLength.TooLong"
/>
<exclude
name=
"Generic.ControlStructures.InlineControlStructure"
/>
<exclude
name=
"Squiz.ControlStructures.ControlSignature"
/>
<!-- doesn't work without above rule -->
</rule>
<arg
name=
"tab-width"
value=
"4"
/>
...
...
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