Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/offlineimap/folder/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyc
�
��Vc@spddlZddlmZddlmZyddlZWnnXddlmZdefd��YZ	dS(i����N(texc_info(tLocki(t
BaseFoldertLocalStatusSQLiteFoldercBseZdZdZd�Zd�Zd�Zd�Zd�Zde
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zde�d�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(snLocalStatus backend implemented with an SQLite database

    As python-sqlite currently does not allow to access the same sqlite
    objects from various threads, we need to open get and close a db
    connection and cursor for all operations. This is a big disadvantage
    and we might want to investigate if we cannot hold an object open
    for a thread somehow.icCs�d|_tt|�j||�|j|_tjj|j�|j	��|_
i|_t|_
tjj|j
�}tjj|�s�tj|�ntjj|�s�td|��nt�|_ytj|j
dt�|_Wnltk
rtd|j
�dt�d�n<tjk
rY}td|j
|f�dt�d�nXtjdksutd��y|jjd	�}Wntjk
r�|j �n6Xt!|j"�d
�}|tj#kr�|j$|�ndS(Nt.s-SQLite database path '%s' is not a directory.tcheck_same_threadsmSQLite backend chosen, but cannot connect with available bindings to '%s'. Is the sqlite3 package installed?.is�cannot open database file '%s': %s.
You might want to check the rights to that file and if it cleanly opens with the 'sqlite<3>' command.is'Your sqlite is not multithreading safe.s1SELECT value from metadata WHERE key='db_version'i(%tseptsuperRt__init__troottostpathtjointgetroottgetfolderbasenametfilenametmessagelisttFalset
_newfoldertdirnametexiststmakedirstisdirtUserWarningRt_dblocktsqlitetconnectt
connectiont	NameErrortNoneRtOperationalErrortthreadsafetytAssertionErrortexecutet
DatabaseErrort#_LocalStatusSQLiteFolder__create_dbtinttfetchonetcur_versiont$_LocalStatusSQLiteFolder__upgrade_db(tselftnamet
repositoryRtetcursortversion((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyR.s<	$		

$	
cCstS(N(R(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytstoresmessagesascCs|jS(N(R(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytgetfullnamedscCs|jS(N(R(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytisnewfolderhscCs|jd�dS(sDelete all messages in the db.sDELETE FROM statusN(t#_LocalStatusSQLiteFolder__sql_write(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytdeletemessagelistmscCs t}x|s|jj�z�y�|dkr^|rI|jj|�}q�|jj|�}n3|r||jj||�}n|jj||�}t}|jj�Wn^t	j
k
r}|jddkr�q|jddkr�|jj
dd�t}q�nXWd|jj�Xq	W|S(s�Execute some SQL, retrying if the db was locked.

        :param sql: the SQL string passed to execute()
        :param vars: the variable values to `sql`. E.g. (1,2) or {uid:1,
            flags:'T'}. See sqlite docs for possibilities.
        :param executemany: bool indicating whether we want to
            perform conn.executemany() or conn.execute().
        :returns: the Cursor() or raises an Exceptionis(cannot commit - no transaction is activesdatabase is lockedts!Locked sqlite database, retrying.N(RRtacquireRRtexecutemanyR!tTruetcommitRRtargstuitdebugtrelease(R(tsqltvarsR5tsuccessR,R+((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyt__sql_writess.
	
	cCs�t|d�r|jj�ntj|jdt�|_|dkr�|jjd|j	|f�|jj
d�|jj�ndS(s<Upgrade the sqlite format from version 'from_ver' to currentRRisAUpgrading LocalStatus cache from version 1 to version 2 for %s:%ss!ALTER TABLE status ADD mtime INTEGER DEFAULT 0;
                                             ALTER TABLE status ADD labels VARCHAR(256) DEFAULT '';
                                             UPDATE metadata SET value='2' WHERE key='db_version';
                                          N(thasattrRtcloseRRRRR9t_msgR*t
executescriptR7(R(tfrom_ver((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyt__upgrade_db�s	cCsG|jjd|j|f�|jjd�|jj�t|_dS(suCreate a new db file.

        self.connection must point to the opened and valid SQlite
        database connection.s&Creating new Local Status db for %s:%ss�
        CREATE TABLE metadata (key VARCHAR(50) PRIMARY KEY, value VARCHAR(128));
        INSERT INTO metadata VALUES('db_version', '2');
        CREATE TABLE status (id INTEGER PRIMARY KEY, flags VARCHAR(50), mtime INTEGER, labels VARCHAR(256));
        N(R9RBR*RRCR7R6R(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyt__create_db�s	
cCs-i|d6t�d6t�d6dd6dd6S(Ntuidtflagstlabelsittimetmtime(tset(R(RG((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytmsglist_item_initializer�scCsi|_|jjd�}x�|D]�}|d}|j|�|j|<t|d�}yNtg|djd�D]*}t|j��dkrr|j�^qr�}Wntk
r�t�}nX||j|d<||j|d<|d|j|d	<q"WdS(
Ns(SELECT id,flags,mtime,labels from statusiiit,RHRIiRK(	RRR!RMRLtsplittlentstriptAttributeError(R(R,trowRGRHtlbRI((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytcachemessagelist�s	

H

cCs
i|_dS(N(R(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytdropmessagelistcache�scCsdS(N((R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytsave�scCs�g}xr|jj�D]a\}}|d}djt|d��}djt|d��}|j||||f�qW|jd|dt�dS(	s-Saves the entire messagelist to the database.RKR3RHs, RIsFINSERT OR REPLACE INTO status (id,flags,mtime,labels) VALUES (?,?,?,?)R5N(RtitemsRtsortedtappendR1R6(R(tdataRGtmsgRKRHRI((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytsaveall�s
	cCs|jS(N(R(R(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytgetmessagelistsicCs�|dkr|S|j|�r3|j||�|S|j|�|j|<i|d6|d6|d6|d6|d6|j|<djt|��}djt|��}|jd	||||f�|S(
s�Writes a new message, with the specified uid.

        See folder/Base for detail. Note that savemessage() does not
        check against dryrun settings, so you need to ensure that
        savemessage is never called in a dryrun mode.iRGRHRJRKRIR3s, s;INSERT INTO status (id,flags,mtime,labels) VALUES (?,?,?,?)(t	uidexiststsavemessageflagsRMRRRYR1(R(RGtcontentRHtrtimeRKRI((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytsavemessage#s0	cCsU|j|�st�||j|d<djt|��}|jd||f�dS(NRHR3s$UPDATE status SET flags=? WHERE id=?(R_R RRRYR1(R(RGRH((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyR`<scCs|j|dS(NRH(R(R(RG((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytgetmessageflagsCscCs|||j|d<|r+||j|d<ndjt|��}|rb|jd|||f�n|jd||f�dS(NRIRKs, s.UPDATE status SET labels=?, mtime=? WHERE id=?s%UPDATE status SET labels=? WHERE id=?(RRRYR1(R(RGRIRK((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytsavemessagelabelsGscCs�g|j�D]'\}}djt|��|f^q
}|jd|dt�x+|j�D]\}}||j|d<q]WdS(sY
        Saves labels from a dictionary in a single database operation.
        
        s, s%UPDATE status SET labels=? WHERE id=?R5RIN(RXRRYR1R6R(R(RIRGtlR[((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytsavemessageslabelsbulkRs:cCs�g}xE|D]=}|j|d|B}|jdjt|��|f�q
W|jd|dt�x.|D]&}|j|d|B|j|d<qkWdS(NRIs, s%UPDATE status SET labels=? WHERE id=?R5(RRZRRYR1R6(R(tuidsRIR[RGt	newlabels((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytaddmessageslabels]s
&
cCs�g}xE|D]=}|j|d|}|jdjt|��|f�q
W|jd|dt�x.|D]&}|j|d||j|d<qkWdS(NRIs, s%UPDATE status SET labels=? WHERE id=?R5(RRZRRYR1R6(R(RhRIR[RGRi((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytdeletemessageslabelsgs
&
cCs|j|dS(NRI(R(R(RG((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytgetmessagelabelsqscCssg|j�D]\}}||f^q
}|jd|dt�x+|j�D]\}}||j|d<qNWdS(sGSaves mtimes from the mtimes dictionary in a single database operation.s$UPDATE status SET mtime=? WHERE id=?R5RKN(RXR1R6R(R(tmtimesRGtmtR[((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytsavemessagesmtimebulkus+cCs|j|dS(NRK(R(R(RG((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytgetmessagemtime~scCs4||jkrdS|jd|f�|j|=dS(NsDELETE FROM status WHERE id=?(RR1(R(RG((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyt
deletemessage�scCspg|D]}||jkr|^q}t|�s8dS|jdt|�t�x|D]}|j|=qXWdS(s�Delete list of UIDs from status cache

        This function uses sqlites executemany() function which is
        much faster than iterating through deletemessage() when we have
        many messages to delete.NsDELETE FROM status WHERE id=?(RRPR1tzipR6(R(tuidlistRG((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pytdeletemessages�s(
N(!t__name__t
__module__t__doc__R&RR.R/R0R2RRR1R'R#RMRURVRWR]R^RLRcR`RdReRgRjRkRlRoRpRqRt(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyRs8		3				&							5					
	
					(
R
tsysRt	threadingRtsqlite3RtBaseRR(((sH/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatusSQLite.pyt<module>s

Spamworldpro Mini