-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsole_abstract.php
3470 lines (3045 loc) · 122 KB
/
console_abstract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Primary logic entry point file
*
* - Defines global configuration & constants
* - Defines the Console_Abstract class
*
* @package pcon
* @author chrisputnam9
*/
// Global Constants
if (! defined('DS')) {
/*
* @var string Directory separator for this OS
* @global
*/
define('DS', DIRECTORY_SEPARATOR);
}
if (defined('ERRORS') and ERRORS) {
// Enable and show errors
echo "\n\n************************************\n";
echo "* Displaying all errors & warnings *\n";
echo "************************************\n\n";
error_reporting(E_ALL);
ini_set('display_errors', 1);
} else {
// Otherwise, we'll follow the system settings
}
if (! defined('PACKAGED') or ! PACKAGED and is_dir(__DIR__ . DS . "lib")) {
$lib_files = scandir(__DIR__ . DS . "lib");
sort($lib_files);
foreach ($lib_files as $file) {
$path = __DIR__ . DS . "lib" . DS . $file;
if (is_file($path) and preg_match('/\.php$/', $path)) {
require $path ;
}
}
}
if (! class_exists("Console_Abstract")) {
/**
* The main console abstract which all console tools extend
*
* - Is itself an extension of the "Command" class
* - Includes default commands that many tools might wish to use
* - Includes default internal supporting functionality likely to be used by tools,
* but not by subcommands
*
* Sub-commands should be defined as public methods,
* and added to the static $METHODS property
*
* All public non-static properties will be configurable
* - They will have default values set here
* - But, they will also be added to the tool's config file for modification
*
* Dynamic help information should be added for each subcommand and configurable property
* using the same name, with __ prepended - see default / built-in subcommands
* and confiurable properties for syntax.
*/
class Console_Abstract extends Command
{
/**
* Default output height limit, if unable to determine dynamically
*
* @var integer
*/
protected const DEFAULT_HEIGHT = 30;
/**
* Default output width limit, if unable to determine dynamically
*
* @var integer
*/
protected const DEFAULT_WIDTH = 130;
/**
* Screen percentage for first column of table output
*
* @var integer
*/
protected const COL1_WIDTH = 20;
/**
* Screen percentage for second column of table output
*
* @var integer
*/
protected const COL2_WIDTH = 50;
/**
* Separator for data entry via text editor
*
* @var string
*/
protected const EDIT_LINE_BREAK = "--------------------------------------------------";
/**
* Value to show user as an option to go to prior selection / area
*
* @var string
*/
protected const BACK_OPTION = '<-- Go Back [B]';
/**
* Callable Methods
*
* - Must be public methods defined on the class
*
* @var array
*/
protected static $METHODS = [
'backup',
'eval_file',
'install',
'update',
'version',
];
/**
* Methods that are OK to run as root without warning
*
* - Must be values specified in static $METHODS
*
* @var array
*/
protected static $ROOT_METHODS = [
'help',
'install',
'update',
'version',
];
/**
* Config options that are hidden from help output
*
* - Add config values here that would not typically be overridden by a flag
* - Cleans up help output and avoids confusion about values that are more often
* used in configuration than in flags.
*
* @var array
*/
protected static $HIDDEN_CONFIG_OPTIONS = [
'__WSC__',
'backup_age_limit',
'backup_dir',
'browser_exec',
'cache_lifetime',
'editor_exec',
'editor_modify_exec',
'install_path',
'livefilter',
'step',
'timezone',
'update_auto',
'update_check_hash',
'update_last_check',
'update_version_url',
];
/**
* Path config options
*
* - These will be treated as filepaths for processing
* - This enables paths that reference '~' as the user's home folder
*/
protected static $PATH_CONFIG_OPTIONS = [
'backup_dir',
'console_abstract_path',
'install_path',
];
/**
* Help info for $allow_root
*
* @var mixed
*
* @internal
*/
protected $__allow_root = "OK to run as root without warning";
/**
* Whether or not to allow running the tool as root without any warning
*
* @var boolean
* @api
*/
public $allow_root = false;
/**
* Help info for $backup_age_limit
*
* @var mixed
*
* @internal
*/
protected $__backup_age_limit = ["Age limit of backups to keep - number of days, 0 or greater", "string"];
/**
* How many days worth of backups to keep when cleaning up
*
* - Will be passed as X to: find -mtime +X
* - Anything but a non-negative integer could cause errors or unexpected behavior
*
* @var string
* @api
*/
public $backup_age_limit = '30';
/**
* Help info for $backup_dir
*
* @var mixed
*
* @internal
*/
protected $__backup_dir = ["Location to save backups", "string"];
/**
* Path in which to save backups
*
* - If null, backups are disabled
*
* @var string
* @api
*/
public $backup_dir = null;
/**
* Help info for $browser_exec
*
* @var mixed
*
* @internal
*/
protected $__browser_exec = ["Command to open links in browser - %s for link placeholder via sprintf"];
/**
* Browser exec command to use when opening URLs
*
* - %s placeholder is the URL to be opened
*
* @var string
*/
protected $browser_exec = 'nohup google-chrome "%s" >/dev/null 2>&1 &';
/**
* Help info for $cache_lifetime
*
* @var mixed
*
* @internal
*/
protected $__cache_lifetime = ["Default time to cache data in seconds"];
/**
* Default lifetime of cached data in seconds - when to expire
*
* - Defaults to 86400 (24 hours)
*
* @var integer
* @api
*/
public $cache_lifetime = 86400;
/**
* Help info for $editor_exec
*
* @var mixed
*
* @internal
*/
protected $__editor_exec = ["Command to open file in editor - %s for filepath placeholder via sprintf"];
/**
* Editor executable - command to be run when opening a new file
*
* - %s is the filepath placeholder
* - Defaults to vim in *insert* mode
*
* @var string
*/
protected $editor_exec = '/usr/bin/vim -c "startinsert" %s > `tty`';
/**
* Help info for $editor_modify_exec
*
* @var mixed
*
* @internal
*/
protected $__editor_modify_exec = ["Command to open file in editor to review/modify existing text - %s for filepath placeholder via sprintf"];
/**
* Editor executable - command to be run when opening a file for *modification*
*
* - Eg. existing file that is being modified
* - %s is the filepath placeholder
* - Defaults to vim in *normal* mode - preferred for modification
*
* @var string
*/
protected $editor_modify_exec = '/usr/bin/vim %s > `tty`';
/**
* Help info for $install_path
*
* @var mixed
*
* @internal
*/
protected $__install_path = ["Install path of this tool", "string"];
/**
* Install path for packaged tool executables
*
* @var string
* @api
*/
public $install_path = DS . "usr" . DS . "local" . DS . "bin";
/**
* Help info for $livefilter
*
* @var mixed
*
* @internal
*/
protected $__livefilter = ["Status of livefilter for select interface - false/disabled, true/enabled, or autoenter", "string"];
/**
* Status of livefilter for select interface - false/disabled, true/enabled, or autoenter
*
* @var mixed
*/
public $livefilter = 'enabled';
/**
* Help info for $ssl_check
*
* @var mixed
*
* @internal
*/
protected $__ssl_check = "Whether to check SSL certificates with curl";
/**
* Whether to check SSL certificates on network connections
*
* - Defaults to true
*
* @var boolean
* @api
*/
public $ssl_check = true;
/**
* Help info for $stamp_lines
*
* @var mixed
*
* @internal
*/
protected $__stamp_lines = "Stamp / prefix output lines with the date and time";
/**
* Whether to prefix output lines with date and time
*
* - Defaults to false
*
* @var boolean
* @api
*/
public $stamp_lines = false;
/**
* Help info for $step
*
* @var mixed
*
* @internal
*/
protected $__step = "Enable stepping/pause points for debugging";
/**
* Whether to enable stepping / pause points for debugging
*
* - Defaults to false
*
* @var boolean
* @api
*/
public $step = false;
/**
* Help info for $timezone
*
* @var mixed
*
* @internal
*/
protected $__timezone = ["Timezone - from http://php.net/manual/en/timezones.", "string"];
/**
* Timezone - from http://php.net/manual/en/timezones.
*
* - Defaults to "US/Eastern"
*
* @var string
* @api
*/
public $timezone = "America/New_York";
/**
* Help info for $update_auto
*
* @var mixed
*
* @internal
*/
protected $__update_auto = ["How often to automatically check for an update (seconds, 0 to disable)", "int"];
/**
* How often (in seconds) to automatically check for an update
*
* - Defaults to 86400 (24 hours)
* - Set to 0 to disable updates
*
* @var integer
* @api
*/
public $update_auto = 86400;
/**
* Help info for $update_last_check
*
* @var mixed
*
* @internal
*/
protected $__update_last_check = ["Formatted timestap of last update check", "string"];
/**
* Timestamp of last update check
*
* - Not typically set manually
* - Stored in config for easy reference and simplicity
* - Defaults to "" - no update check completed yet
*
* @var string
* @api
*/
public $update_last_check = "";
/**
* Help info for $update_version_url
*
* @var mixed
*
* @internal
*/
protected $__update_version_url = ["URL to check for latest version number info", "string"];
/**
* The URL to check for updates
*
* - Empty string will disable checking for updates
* - The tool child class itself should set a default
* - Common choice would be to use raw URL of Github readme file
* - Set in config to set up a custom update methodology or disable updates
*
* @var string
* @see PCon::update_version_url for an example setting
* @api
*/
public $update_version_url = "";
/**
* Help info for $update_check_hash
*
* @var mixed
*
* @internal
*/
protected $__update_check_hash = ["Whether to check hash of download when updating", "binary"];
/**
* Whether to check the hash when downloading updates
*
* - Defaults to true
*
* @var boolean
* @api
*/
public $update_check_hash = true;
/**
* Help info for $verbose
*
* @var mixed
*
* @internal
*/
protected $__verbose = "Enable verbose output";
/**
* Whether to show log messages - verbose output
*
* - Defaults to false
*
* @var boolean
* @api
*/
public $verbose = false;
/**
* Help info for $__WSC__
*
* @var mixed
*
* @internal
*/
protected $____WSC__ = "HJSON Data for config file";
/**
* HJSON Data for the config file
*
* @var array
* @api
*/
public $__WSC__ = null;
/**
* Config directory
*
* @var string
*/
protected $config_dir = null;
/**
* Config file
*
* @var string
*/
protected $config_file = null;
/**
* Home directory
*
* @var string
*/
protected $home_dir = null;
/**
* Config initialized flag
*
* @var boolean
*/
protected $config_initialized = false;
/**
* Config data to be saved
*
* @var array
*/
protected $config_to_save = null;
/**
* Config is OK to create
*
* @var boolean
*/
protected $config_ok_to_create = true;
/**
* Timestamp when the tool was initilized - eg. when constructor ran
*
* @var string
*/
protected $run_stamp = '';
/**
* The method being called
*
* - set by Command::try_calling
*
* @var string
*/
protected $method = '';
/**
* The user that initially logged in to the current session
*
* - as reported by logname
*
* @var string
*/
protected $logged_in_user = '';
/**
* The currently active user
*
* - as reported by whoami
*
* @var string
*/
protected $current_user = '';
/**
* Whether the user is logged in as root
*
* - Ie. is logged_in_user === 'root'
*
* @var boolean
*/
protected $logged_in_as_root = false;
/**
* Whether user is currently root
*
* - Ie. current_user === 'root'
*
* @var boolean
*/
protected $running_as_root = false;
/**
* Whether tool is running on a Windows operating system
*
* @var boolean
*/
protected $is_windows = false;
/**
* The minimum PHP major version supported by this tool
*
* @var integer
*/
protected $minimum_php_version = "8.0";
/**
* The minimum PHP major version supported by the "livefilter" feature
*
* @var integer
*/
protected $minimum_php_version_livefilter = "8.0";
/**
* Update behavior - either "DOWNLOAD" or custom text
*
* - If set to "DOWNLOAD" then the update will download if available
* - Otherwise, whatever text is set here will show as a message - ie. instructions
* on how to update the tool manually.
* - Defaults to 'DOWNLOAD' as that is what most tools will use
* - However, as an example, PCon::update_behavior instructs users to pull the git repository to update it
*
* @var string
*/
protected $update_behavior = 'DOWNLOAD';
/**
* The standard/default pattern to identify the latest version and URL
* within the text found at $this->update_version_url.
*
* - By default, group 1 is the version - see $this->update_version_pattern
* - By default, group 2 is the download URL - see $this->pdate_download_pattern
* - Defaults to look for a string like:
* Download Latest Version (1.1.1):
* https://example.com
*
* @var string
*/
protected $update_pattern_standard = "~
download\ latest\ version \s*
\( \s*
( [\d.]+ )
\s* \) \s* :
\s* ( \S* ) \s*$
~ixm";
/**
* The standard/default pattern to identify the hash of the latest version download
* within the text found at $this->update_version_url.
*
* - By default, group 1 is the algorithm - see $this->update_hash_algorithm_pattern
* - By default, group 2 is the hash - see $this->update_hash_pattern
* - Defaults to look for a string like:
* Latest Version Hash (md5):
* hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
*
* @var string
*/
protected $hash_pattern_standard = "~
latest\ version\ hash \s*
\( \s*
( .+ )
\s* \) \s* :
\s* ([0-9a-f]+)
~ixm";
/**
* Instructions to find update version at $this->update_version_url.
*
* - First element is pattern
* - Defaults to true to use $update_pattern_standard
* - Second element is match index
* - Defaults to 1 to use first match group as version
*
* @var array
*/
protected $update_version_pattern = [ true, 1 ];
/**
* Instructions to find update download URL at $this->update_version_url.
*
* - First element is pattern
* - Defaults to true to use $update_pattern_standard
* - Second element is match index
* - Defaults to 2 to use second match group as version
*
* @var array
*/
protected $update_download_pattern = [ true, 2 ];
/**
* Instructions to find download hash algorithm at $this->update_version_url.
*
* - First element is pattern
* - Defaults to true to use $hash_pattern_standard
* - Second element is match index
* - Defaults to 1 to use first match group as version
*
* @var array
*/
protected $update_hash_algorithm_pattern = [ true, 1 ];
/**
* Instructions to find download hash at $this->update_version_url.
*
* - First element is pattern
* - Defaults to true to use $hash_pattern_standard
* - Second element is match index
* - Defaults to 2 to use second match group as version
*
* @var array
*/
protected $update_hash_pattern = [ true, 2 ];
/**
* Whether an update exists or not - to avoid multiple checks
*
* @var boolean
*
* @internal
*/
protected $update_exists = null;
/**
* Latest version available for update
*
* @var string
*
* @internal
*/
protected $update_version = "0";
/**
* URL of latest version available for update
*
* @var string
*
* @internal
*/
protected $update_url = "";
/**
* Hash algorithm to use for packaging and update verification
*
* - Defaults to md5
*
* @var string
*/
protected $update_hash_algorithm = "md5";
/**
* Hash of latest version available for update
*
* @var string
*
* @internal
*/
protected $update_hash = "";
/**
* Constructor
*
* - Sets default timezone for date functions to use
* - Sets run_stamp
* - Determines runtime details - user, OS
* - Calls parent (Command) constructor
*/
public function __construct()
{
$this->checkRequirements();
date_default_timezone_set($this->timezone);
$this->run_stamp = $this->stamp();
exec('logname', $logged_in_user, $return);
if ($return == 0 and ! empty($logged_in_user)) {
$this->logged_in_user = trim(implode($logged_in_user));
}
$this->logged_in_as_root = ($this->logged_in_user === 'root');
exec('whoami', $current_user, $return);
if ($return == 0 and ! empty($current_user)) {
$this->current_user = trim(implode($current_user));
}
$this->running_as_root = ($this->current_user === 'root');
$this->is_windows = (strtolower(substr(PHP_OS, 0, 3)) === 'win');
parent::__construct($this);
}//end __construct()
/**
* Check requirements
*
* - Eg. PHP Version & Modules
* - Extend in child if needed and pass problems to parent
*
* @param array $problems Existing problems passed by child class.
*
* @return void
*/
protected function checkRequirements(array $problems = [])
{
$this->log("PHP Version: " . PHP_VERSION);
$this->log("OS: " . PHP_OS);
$this->log("Windows: " . ($this->is_windows ? "Yes" : "No"));
$major_problem = false;
if (version_compare(PHP_VERSION, $this->minimum_php_version) < 0) {
$problems[] = "This tool is not well tested below PHP " . $this->minimum_php_version .
"\n - Please upgrade to PHP " . $this->minimum_php_version . " or higher";
}
if (! function_exists('curl_version')) {
$problems[] = "This tool requires curl - please install https://www.php.net/manual/en/book.curl.php - specific install steps vary by OS";
$major_problem = true;
}
if (! function_exists('mb_strlen')) {
$problems[] = "This tool requires mbstring - please install https://www.php.net/manual/en/book.mbstring.php - specific install steps vary by OS";
$major_problem = true;
}
if (! empty($problems)) {
$this->error("There are some problems with requirements: \n - " . implode("\n - ", $problems), $major_problem, true);
}
}//end checkRequirements()
/**
* Check requirements that need to be informed by config values
*
* - Extend in child if needed and pass problems to parent
*
* @param array $problems Existing problems passed by child class.
*
* @return void
*/
protected function checkRequirementsAfterConfigLoad(array $problems = [])
{
$major_problem = false;
if ($this->livefilter !== "disabled" && $this->livefilter !== false) {
if (version_compare(PHP_VERSION, $this->minimum_php_version_livefilter) < 0) {
$problems[] = "Livefilter does not work well below PHP " . $this->minimum_php_version_livefilter .
"\n - Either upgrade to PHP " . $this->minimum_php_version_livefilter . " or higher" .
"\n - Or set livefilter to 'disabled' in " . $this->config_file;
}
}
if ($this->livefilter && $this->is_windows) {
$problems[] = "Livefilter is not supported on Windows";
$major_problem = true;
}
if (! empty($problems)) {
$this->error("There are some problems with requirements: \n - " . implode("\n - ", $problems), $major_problem, true);
}
}//end checkRequirementsAfterConfigLoad()
/**
* Run - parse args and run method specified
*
* - Entry point for the tool - child class will run this
* - Eg. see Pcon class
*
* @param array $arg_list Array of args passed via command line (Ie. built-in $argv).
*
* @return void
*/
public static function run(array $arg_list = [])
{
$class = get_called_class();
$script = array_shift($arg_list);
$instance = new $class();
try {
$instance->_startup($arg_list);
$instance->initConfig();
$instance->checkRequirementsAfterConfigLoad();
$instance->try_calling($arg_list, true);
$instance->_shutdown($arg_list);
} catch (Exception $e) {
$instance->error($e->getMessage());
}
}//end run()
/**
* Help info for backup method
*
* @var mixed
*
* @internal
*/
protected $___backup = [
"Backup a file or files to the configured backup folder",
["Paths to back up", "string", "required"],
["Whether to output when backup is complete"]
];
/**
* Method to backup files used by the tool
*
* @param mixed $files File(s) to back up.
* @param boolean $output Whether to output information while running.
*
* @return boolean Whether backup was successful.
* @api
*/
public function backup($files, bool $output = true): bool
{
$success = true;
$files = $this->prepArg($files, []);
if (empty($this->backup_dir)) {
$this->warn('Backups are disabled - no backup_dir specified in config', true);
return false;
}
if (! is_dir($this->backup_dir)) {
mkdir($this->backup_dir, 0755, true);
}
foreach ($files as $file) {
$this->output("Backing up $file...", false);
if (! is_file($file)) {
$this->br();
$this->warn("$file does not exist - skipping", true);
continue;
}
$backup_file = $this->backup_dir . DS . basename($file) . '-' . $this->stamp() . '.bak';
$this->log(" - copying to $backup_file");
// Back up target
$success = ($success and copy($file, $backup_file));
if ($success) {
$this->output('successful');
} else {
$this->br();
$this->warn("Failed to back up $file", true);
continue;
}
}//end foreach
// Clean up old backups - keep backup_age_limit days worth
$this->exec("find \"{$this->backup_dir}\" -mtime +{$this->backup_age_limit} -type f -delete");
return $success;
}//end backup()
/**
* Help info for eval_file method
*
* @var mixed