DAY-1 Source code fix remove_logo

DAY-1 Source code fix remove_logo

proposal for ci4 upgrade code to a stable version, manage remove_logo // IN /root/app/Controllers/Config.php
Categories

DAY 1
thanks @owlbrudder

following explanation:
the company_logo config option allows you to replace the OSPOS logo with the company logo, OK

  1. Add company logo YES
  2. validate the config modification YES after fix
  3. delete the logo NO because it does not disappear on disk, only in the database TABLE ospos_app_config KEY company_logo
  4. if we reload a new company logo the name on the disk will be indexed filename_1...
    NOTE company logo can only be loaded once.
    Like /root/app/controllers/Config.php --- remove_logo method
    FIX rename remove_logo with postRemove_logo
    code
  	public function postRemove_logo(): void
	{
		$file = FCPATH.'uploads/' . $this->config['company_logo'];
		if (is_readable($file) && unlink($file)) {
			$success = $this->appconfig->save(['company_logo' => '']);
		} else {
			$success = "The file was not found";
		}
		$success = $this->appconfig->save(['company_logo' => '']);
		
		echo json_encode (['success' => $success]);
	}
 

PS I use code tags, I don't understand why it's buggy??? OK I found thanks @objecttothis your code
best regards

Comments

Related posts

DAY-2 Source code fix  upload_logo

DAY-2 Source code fix upload_logo

proposal for ci4 upgrade code to a stable version, manage upload_logo // IN /root/app/Controllers/Config.php
DAY-3 various code fixes, critical error

DAY-3 various code fixes, critical error

Various fixes to apply causing a critical error