
    jg                         d dl Z d Zy)    Nc           	      
   | j                  di       j                  d      }|rt        j                  ddddddd      }ddl}|j	                  |j
                  j                  |             	 |j                  dd      }|j                  dd	      }|j                  dd
      }|j                  dd      }|j                  dd      }|j                  dd      }	|dk(  r|	r|	}|||||fS y# t        j                  $ r Y yw xY w)a\  
    Attempt to parse mysql database config file for connection settings.
    Ideally we would hook into django's code to do this, but read_default_file is handled by the mysql C libs
    so we have to emulate the behaviour

    Settings that are missing will return ''
    returns (user, password, database_name, database_host, database_port)
    OPTIONSread_default_file )userpassworddatabasehostportsocketr   Nclientr   r   r	   r
   r   r   	localhost)r   r   r   r   r   )getconfigparserRawConfigParserosreadpath
expanduserNoSectionError)
dbinfor   configr   r   r   database_namedatabase_hostdatabase_portr   s
             ]/var/www/html/Stanley/venv/lib/python3.12/site-packages/django_extensions/management/mysql.pyparse_mysql_cnfr      s    

9b1556IJ--/
  	BGG&&'89:	::h/Dzz(J7H"JJx<M"JJx8M"JJx8MZZ(3F+ &=-NN
  ** 		s   /A;C, ,DD)r   r        r   <module>r       s    &r   