فهرست منبع

https://github.com/openNAMU/openNAMU/issues/1685

잉여개발기 (SPDV) 3 سال پیش
والد
کامیت
e418d1bba5
6فایلهای تغییر یافته به همراه28 افزوده شده و 13 حذف شده
  1. 2 1
      app.py
  2. 3 7
      route/list_old_page.py
  3. 1 1
      route/main_tool_other.py
  4. 19 1
      route/tool/func.py
  5. 1 1
      route/view_read.py
  6. 2 2
      version.json

+ 2 - 1
app.py

@@ -308,7 +308,8 @@ app.route('/extension_filter/add', methods = ['POST', 'GET'], defaults = { 'tool
 
 # Func-list
 # /list/document/old
-app.route('/old_page')(list_old_page)
+app.route('/list/document/old')(list_old_page)
+app.route('/list/document/old/<int:num>')(list_old_page)
 
 # /list/document/acl
 @app.route('/acl_list')

+ 3 - 7
route/list_old_page.py

@@ -1,11 +1,9 @@
 from .tool.func import *
 
-def list_old_page():
+def list_old_page(num = 1):
     with get_db_connect() as conn:
         curs = conn.cursor()
         
-        num = flask.request.args.get('num', '1')
-        num = int(number_check(num))
         sql_num = (num * 50 - 50) if num * 50 > 0 else 0
         
         curs.execute(db_change('select data from other where name = "count_all_title"'))
@@ -14,14 +12,12 @@ def list_old_page():
         
         div = '<ul class="opennamu_ul">'
         
-        curs.execute(db_change('' + \
-            'select h.title, max(h.date) from history as h where not (title like "user:%" or title like "category:%" or title like "file:%") and exists (select title from data where title = h.title) and not exists (select title from back where link = h.title and type = "redirect") group by h.title order by h.date asc limit ?, 50' + \
-        ''), [sql_num])
+        curs.execute(db_change("select doc_name, set_data from data_set where set_name = 'last_edit' order by set_data asc"))
         n_list = curs.fetchall()
         for data in n_list:
             div += '<li>' + data[1] + ' | <a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
         
-        div += '</ul>' + next_fix('/old_page?num=', num, n_list)
+        div += '</ul>' + next_fix('/list/document/old/', num, n_list)
         
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('old_page'), wiki_set(), wiki_custom(), wiki_css([0, 0])],

+ 1 - 1
route/main_tool_other.py

@@ -28,7 +28,7 @@ def main_tool_other():
                     <li><a href="/please">''' + load_lang('need_document') + '''</a></li>
                     <li><a href="/long_page">''' + load_lang('long_page') + '''</a></li>
                     <li><a href="/short_page">''' + load_lang('short_page') + '''</a></li>
-                    <li><a href="/old_page">''' + load_lang('old_page') + '''</a></li>
+                    <li><a href="/list/document/old">''' + load_lang('old_page') + '''</a></li>
                 </ul>
                 <h3>''' + load_lang('user') + '''</h3>
                 <ul class="opennamu_ul">

+ 19 - 1
route/tool/func.py

@@ -634,6 +634,21 @@ def update(ver_num, set_data):
         curs.execute(db_change("drop index history_index"))
         curs.execute(db_change("create index history_index on history (title, ip)"))
 
+    if ver_num < 3500359:
+        # 마지막 편집 따로 기록하도록
+        # create_data['data_set'] = ['doc_name', 'doc_rev', 'set_name', 'set_data']
+        print("Update 3500359...")
+
+        curs.execute(db_change("select title from data"))
+        db_data = curs.fetchall()
+        for for_a in db_data:
+            curs.execute(db_change("select date from history where title = ? order by date desc limit 1"), [for_a[0]])
+            db_data_2 = curs.fetchall()
+            if db_data_2:
+                curs.execute(db_change("insert into data_set (doc_name, doc_rev, set_name, set_data) values (?, '', 'last_edit', ?)"), [for_a[0], db_data_2[0][0]])
+
+        print("Update 3500359 complete")
+
     conn.commit()
     
     # 아이피 상태인 이메일 제거 예정
@@ -2003,7 +2018,10 @@ def ip_pas(raw_ip, type_data = 0):
                 else:
                     ip = ip.exploded
                     ip = re.sub(r'\.([^.]*)\.([^.]*)$', '.*.*', ip)
-                    
+                
+                # ip = hashlib.sha3_224(bytes(raw_ip, 'utf-8')).hexdigest()
+                # ip = ip[0:4] + '-' + ip[4:8] + '-' + ip[8:12] + '-' + ip[12:16]
+
                 change_ip = 1
             except:
                 ip = raw_ip

+ 1 - 1
route/view_read.py

@@ -228,7 +228,7 @@ def view_read(name = 'Test', doc_rev = '', doc_from = '', do_type = ''):
             if down:
                 menu += [['down/' + url_pas(name), load_lang('sub')]]
 
-            curs.execute(db_change("select date from history where title = ? order by date desc limit 1"), [name])
+            curs.execute(db_change("select set_data from data_set where doc_name = ? and set_name = 'last_edit'"), [name])
             r_date = curs.fetchall()
             r_date = r_date[0][0] if r_date else 0
 

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC2-dev135",
-        "c_ver" : "3500358",
+        "r_ver" : "v3.4.6-RC2-dev136",
+        "c_ver" : "3500359",
         "s_ver" : "3500111"
     }
 }