Pārlūkot izejas kodu

remove examples from code to put in documentation

Tim Fry 1 gadu atpakaļ
vecāks
revīzija
6de565d1e1
1 mainītis faili ar 0 papildinājumiem un 73 dzēšanām
  1. 0 73
      resources/classes/maintenance_logs.php

+ 0 - 73
resources/classes/maintenance_logs.php

@@ -85,79 +85,6 @@ class maintenance_logs {
 		}
 		}
 	}
 	}
 
 
-//	/**
-//	 * Called when a file system maintenance is triggered from the maintenance service.
-//	 * <p>Maintenance logs does not use the filesystem. This is here only as an example
-//	 * for implementing a quota system for voicemail messages. This code has not been
-//	 * thoroughly tested.</p>
-//	 * @param settings $settings
-//	 * @return void
-//	 */
-//	public static function filesystem_maintenance(settings $settings): void {
-//		$database = $settings->database();
-//		$voicemail_location = $settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage/voicemail') . '/default';
-//		$domains = maintenance_service::get_domains($database, true);
-//		foreach ($domains as $domain_uuid => $domain_name) {
-//			$domain_settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid]);
-//			$quota_bytes = $domain_settings('maintenance', self::class . '_filesystem_quota_bytes');
-//			$directory = $voicemail_location . "/$domain_name/*";
-//			$wav_files = glob($directory . '/msg_*.wav');
-//			$mp3_files = glob($directory . '/msg_*.mp3');
-//			$voicemail_files = array_merge($wav_files, $mp3_files);
-//			$files = [];
-//			foreach ($voicemail_files as $file) {
-//				$files[] = [
-//					'path' => $file,
-//					'size' => filesize ($file),
-//					'mtime' => filemtime($file)
-//				];
-//			}
-//			usort($files, function ($a, $b) {
-//				if (!empty($a) && !empty($b)) {
-//					return $a['mtime'] <=> $b['mtime'];
-//				} else {
-//					return 0;
-//				}
-//			});
-//			$total_bytes = array_sum(array_column($files, 'size'));
-//			foreach ($files as $file) {
-//				while ($total_bytes > $quota_bytes) {
-//					//directory is over quota
-//					if (unlink($file['path'])) {
-//						maintenance_service::log_write(self::class, "Removed oldest voicemail file:" . $file['path'], $domain_uuid);
-//						$total_bytes -= $file['size'];
-//					} else {
-//						maintenance_service::log_write(self::class, "Failed to delete file: " . $file['path'], $domain_uuid, maintenance_service::LOG_ERROR);
-//					}
-//				}
-//			}
-//		}
-//	}
-
-//	/**
-//	 * Called when a file system maintenance is triggered from the maintenance service.
-//	 * <p>Maintenance logs does not use the filesystem. This is here only as an example for voicemail messages.</p>
-//	 * @param settings $settings
-//	 * @return void
-//	 */
-//	public static function filesystem_maintenance(settings $settings): void {
-//		$database = $settings->database();
-//		$voicemail_location = $settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage/voicemail') . '/default';
-//		$domains = maintenance_service::get_domains($database, true);
-//		foreach ($domains as $domain_uuid => $domain_name) {
-//			$mp3_files = glob("$voicemail_location/$domain_name/*/msg_*.mp3");
-//			$wav_files = glob("$voicemail_location/$domain_name/*/msg_*.wav");
-//			$domain_voicemail_files = array_merge($mp3_files, $wav_files);
-//			foreach ($domain_voicemail_files as $file) {
-//				if (unlink($domain_voicemail_files)) {
-//					maintenance_service::log_write(self::class, "File $file removed successfully", $domain_uuid);
-//				} else {
-//					maintenance_service::log_write(self::class, "Unable to remove $file", $domain_uuid, maintenance_service::LOG_ERROR);
-//				}
-//			}
-//		}
-//	}
-
 	public function __construct(database $database, settings $settings) {
 	public function __construct(database $database, settings $settings) {
 		if ($database !== null) {
 		if ($database !== null) {
 			$this->database = $database;
 			$this->database = $database;