Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/trac/upgrades/__pycache__/ |
Upload File : |
o �k�`� � @ sH d dl Zd dlmZ d dlmZmZmZ d dlm Z dd� Z dd� ZdS ) � N)� Attachment)�exception_to_unicode�printerr� unicode_quote)�_c C sr t j�| jd�}t j�|�sdS t �|�}t j�| j�s"t �| j� |�d� |D ] }t| g|�R � q)t � t j�| jd��D ];\}}}z-t t d�rQt �||j� t t d�rbt |d�rbt � ||j� t t d�rpt �||j|j� W q? tyz Y q?w zt j |d d �D ] \}}}t �|� q�W dS ty� } z| j�d|t| �� ttd|t| �d �� W Y d} ~ dS d} ~ ww )ziMove attachments from the `attachments` directory into `files`, hashing the filenames in the process.�attachmentsNzM SELECT type, id, filename FROM attachment ORDER BY type, id �files�chmod�chflags�st_flags�chownF)�topdownz-Can't delete old attachments directory %s: %sau The upgrade of attachments was successful, but the old attachments directory: %(src_dir)s couldn't be removed, possibly due to the presence of files that weren't referenced in the database. The error was: %(exception)s This error can be ignored, but for keeping your environment clean you should backup any remaining files in that directory and remove it manually. )�src_dir� exception)�os�path�join�exists�stat�attachments_dir�makedirs�execute�move_attachment_file�walk�hasattrr �st_moder r r �st_uid�st_gid�OSError�rmdir�log�warningr r r ) �env�version�cursor�old_attachments_dir�old_stat�row�dir�dirsr �e� r+ �4/usr/lib/python3/dist-packages/trac/upgrades/db28.py� do_upgrade sD �������r- c C s� t j�| jd|t|��}|rt j�|t|��}t j�|�}t j�|�rGt�| j|||�}z t � ||� W d S t yF ttd||d�� � w | j �d|||� d S )Nr zEUnable to move attachment from: %(old_path)s to: %(new_path)s )�old_path�new_pathz3Can't find file for 'attachment:%s:%s:%s', ignoring)r r r r �normpath�isfiler � _get_pathr �renamesr r r r r! )r"