-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify and cleanup HTML signature #109
Unify and cleanup HTML signature #109
Conversation
inc/cachify.class.php
Outdated
* @return bool Show details in signature. | ||
*/ | ||
private static function _signature_details() { | ||
return isset(self::$options['sig_detail']) ? self::$options['sig_detail'] == 1 : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, this could be a bit more readable. Isn't isset(self::$options['sig_detail'])
always true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also about Yoda you must think and strict comparison you must use :)
@@ -1290,7 +1302,8 @@ public static function set_cache( $data ) { | |||
), | |||
self::_cache_hash(), | |||
self::_minify_cache( $data ), | |||
self::_cache_expires() | |||
self::_cache_expires(), | |||
self::_signature_details() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed here? Cachify_DB::store_item
does not expect this information.
Cachify_APC is using it.
inc/cachify_db.class.php
Outdated
@@ -131,7 +132,7 @@ public static function print_cache( $cache ) { | |||
|
|||
/* Signature */ | |||
if ( isset( $cache['meta'] ) ) { | |||
echo self::_cache_signature( $cache['meta'] ); | |||
echo self::_cache_signature( $sigDetail, $cache['meta'] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason to store the signature in APC/HDD/Memcache in the cached page itself while DB is generating the signature during the output process? I think, this would make sense to unify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DB cache signature can provide additional information only available at runtime (e.g. number of actual DB queries). There might be any reason why one would like to see this...
Only possibility to unify call of the "basic" signature would be to add a second comment at runtime or drop the additional data completely (remove $sig_detail
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for clarification :)
inc/cachify_apc.class.php
Outdated
* @param string $hash Hash of the entry. | ||
* @param string $data Content of the entry. | ||
* @param integer $lifetime Lifetime of the entry. | ||
* @param bool $sigDetail Show details in signature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use snake_case format: $sig_detail
inc/cachify_db.class.php
Outdated
* | ||
* @param array $meta Content of metadata. | ||
* @return string Signature string | ||
* @param bool $detail Show details in signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter comment must end with a full stop.
inc/cachify_db.class.php
Outdated
human_time_diff( $meta['time'], current_time( 'timestamp' ) ) | ||
) | ||
); | ||
if ($detail) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after opening bracket and before closing bracket are missing.
inc/cachify_hdd.class.php
Outdated
* | ||
* @return string Signature string | ||
* @param bool $detail Show details in signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fullstop.
Hi @stklcode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks a lot @stklcode ❤️
Addresses issue #108
Unifies signature in HTML comment and provides the ability to remove additional data.
Signature with details (old behavior)
Cleaned signature (default)