Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 69 additions & 82 deletions composer.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ a, a:link, a:active, a:visited {
a:hover {
text-decoration: underline;
}
h1 {height:50px;margin:0;float:right;max-width:500px;}
h1 {margin:0;float:right;max-width:500px;}
h1 a {text-align:right;font-size:20px;float:right;}
h1 a, h1 a:link, h1 a:active, h1 a:visited {color:#2a85b3}
h1 a:hover{text-decoration:none;}
Expand Down Expand Up @@ -287,6 +287,7 @@ a.bookmarklet:hover {
margin-left:15%;
padding-left:10px;
margin-bottom:5px;
clear: both;
}

.jquery-notify-bar {
Expand Down
41 changes: 18 additions & 23 deletions includes/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,48 @@ class Config {
/**
* @var string
*/
protected $root;
protected string $root;

/**
* @var string
*/
protected $config;
protected string $config;

/**
* @since 1.7.3
* @param string $config Optional user defined config path
* @param string $config Optional user defined config path
*/
public function __construct($config = '') {
$this->set_root( $this->fix_win32_path( dirname( dirname( __DIR__ ) ) ) );
public function __construct(string $config = '') {
$this->set_root( $this->fix_win32_path(dirname(__DIR__, 2)) );
$this->set_config($config);
}

/**
* Convert antislashes to slashes
* Convert backslashes to slashes
*
* @since 1.7.3
* @param string $path
* @param string $path
* @return string path with \ converted to /
*/
public function fix_win32_path($path) {
public function fix_win32_path(string $path): string {
return str_replace('\\', '/', $path);
}

/**
* @since 1.7.3
* @param string $config path to config file
* @param string $config path to config file
* @return void
*/
public function set_config($config) {
public function set_config(string $config): void {
$this->config = $config;
}

/**
* @since 1.7.3
* @param string $root path to YOURLS root directory
* @param string $root path to YOURLS root directory
* @return void
*/
public function set_root($root) {
public function set_root(string $root): void {
$this->root = $root;
}

Expand All @@ -65,7 +65,7 @@ public function set_root($root) {
* @return string path to found config file
* @throws ConfigException
*/
public function find_config() {
public function find_config(): string {

$config = $this->fix_win32_path($this->config);

Expand Down Expand Up @@ -99,7 +99,7 @@ public function find_config() {
* @return void
* @throws ConfigException
*/
public function define_core_constants() {
public function define_core_constants(): void {
// Check minimal config job has been properly done
$must_haves = array('YOURLS_DB_USER', 'YOURLS_DB_PASS', 'YOURLS_DB_NAME', 'YOURLS_DB_HOST', 'YOURLS_DB_PREFIX', 'YOURLS_SITE');
foreach($must_haves as $must_have) {
Expand Down Expand Up @@ -201,16 +201,11 @@ public function define_core_constants() {
if (!defined( 'YOURLS_ADMIN_SSL' ))
define( 'YOURLS_ADMIN_SSL', false );

// if set to true, verbose debug infos. Will break things. Don't enable.
if (!defined( 'YOURLS_DEBUG' ))
define( 'YOURLS_DEBUG', false );

// Error reporting
if (defined( 'YOURLS_DEBUG' ) && YOURLS_DEBUG == true ) {
error_reporting( -1 );
} else {
error_reporting( E_ERROR | E_PARSE );
// if set to true, verbose debug infos
if (!defined( 'YOURLS_DEBUG' )) {
define('YOURLS_DEBUG', false);
}

}

}
5 changes: 5 additions & 0 deletions includes/Database/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class Logger extends AbstractLogger {
public function log($level, string|\Stringable $message, array $context = []): void {
// if it's an internal SQL query, format the message, otherwise store a string
if($level === 'query') {
// Get the real function name that called the query (not just "perform")
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 6);
// We should have at index 5 "fetchSomething" (eg fetchAll, fetchOne, etc), otherwise make it "perform"
$function = $backtrace[5]['function'] ?? 'perform';
$context['function'] = str_starts_with($function, 'fetch') ? $function : 'perform';
$this->messages[] = sprintf(
'SQL %s: %s (%s s)',
$context['function'],
Expand Down
Loading
Loading