Skip to content

Commit

Permalink
removed "/dryrun" flag from query command and added function to write…
Browse files Browse the repository at this point in the history
… datetime of last successfull sync to the registry
  • Loading branch information
sonicnkt committed Jul 21, 2017
1 parent b2530d1 commit ad802ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion make_installer.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
SET VERSION=0.17.16
SET VERSION=0.17.17
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
SET NSIS="%ProgramFiles%\NSIS\makensis.exe"
SET PYTHON32="c:\python26\python.exe"
Expand Down
7 changes: 7 additions & 0 deletions src/WpkgConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import win32crypt, pywintypes
import re
import datetime

class NullHandler(logging.Handler):
def emit(self, record):
Expand Down Expand Up @@ -66,6 +67,12 @@ def set_wpkg_runningstate(self, state):
_winreg.KEY_ALL_ACCESS | _winreg.KEY_WOW64_64KEY) as key:
_winreg.SetValueEx(key, "running", 0, _winreg.REG_SZ, state)

def set_wpkg_synctime(self):
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE, R"SOFTWARE\WPKG", 0,
_winreg.KEY_ALL_ACCESS | _winreg.KEY_WOW64_64KEY) as key:
_winreg.SetValueEx(key, "lastsync", 0, _winreg.REG_SZ, current_time)

def get_codepage(self):
try:
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, R"SYSTEM\CurrentControlSet\Control\Nls\CodePage", 0,
Expand Down
4 changes: 3 additions & 1 deletion src/WpkgExecuter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def Query(self, handle=None):

# Adding query and dryrun parameter to execute command
# /dryrun is used to the file date of wpkg.xml is untouched
self.query_command = self.execute_command + ' /query:Iudr /dryrun'
self.query_command = self.execute_command + ' /query:Iudr'
if self.is_running:
logger.info(R"Client requested WPKG to execute query, but WPKG is already running.")
msg = "201 " + _("Info: WPKG is already running a task.")
Expand Down Expand Up @@ -289,6 +289,8 @@ def Execute(self, handle=None, rebootcancel=False):
else:
self.reboot_handler.reset_reboot_number()

self.config.set_wpkg_synctime()

def Cancel(self, handle=sys.stdout):
if self.isrunning:
self.proc.kill()
Expand Down

0 comments on commit ad802ad

Please sign in to comment.