Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

allow to customize temporary directory and to use syslog instead of temporary file #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions qrconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
* Config file, feel free to modify
*/

define('QR_CACHEABLE', true); // use cache - more disk reads but less CPU power, masks and format templates are stored there

if (!defined('QR_CACHEABLE')) {
define( 'QR_CACHEABLE', true ); // use cache - more disk reads but less CPU power, masks and format templates are stored there
}
if (!defined('QR_CACHE_DIR')) {
define('QR_CACHE_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR); // used when QR_CACHEABLE === true
define('QR_LOG_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR); // default error logs dir
}
if (!defined('QR_LOG_DIR')) {
define( 'QR_LOG_DIR', dirname( __FILE__ ) . DIRECTORY_SEPARATOR ); // default error logs dir
}

define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
define('QR_FIND_FROM_RANDOM', false); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
Expand Down
2 changes: 1 addition & 1 deletion qrencode.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public function encodePNG($intext, $outfile = false,$saveandprint=false)

} catch (Exception $e) {

QRtools::log($outfile, $e->getMessage());
QRtools::log($outfile, $e->getMessage() .' in '. $e->GetFile() . ':' . $e->GetLine());

}
}
Expand Down
3 changes: 3 additions & 0 deletions qrtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public static function log($outfile, $err)
}
}
}
if (defined('QR_LOG_SYSLOG') && QR_LOG_SYSLOG) {
syslog(LOG_ERR, '[QRTOOLS] '. $err);
}
}

//----------------------------------------------------------------------
Expand Down